| 1 |
/* GTK+ - accessibility implementations |
| 2 |
* Copyright 2001 Sun Microsystems Inc. |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#include "config.h" |
| 19 |
|
| 20 |
#include <glib/gi18n-lib.h> |
| 21 |
#include <gtk/gtk.h> |
| 22 |
#include "gtkcontainercellaccessible.h" |
| 23 |
#include "gtkcellaccessibleprivate.h" |
| 24 |
#include "gtkcellaccessibleparent.h" |
| 25 |
|
| 26 |
struct _GtkCellAccessiblePrivate |
| 27 |
{ |
| 28 |
AtkObject *parent; |
| 29 |
}; |
| 30 |
|
| 31 |
static const struct { |
| 32 |
AtkState atk_state; |
| 33 |
GtkCellRendererState renderer_state; |
| 34 |
gboolean invert; |
| 35 |
} state_map[] = { |
| 36 |
{ ATK_STATE_SENSITIVE, GTK_CELL_RENDERER_INSENSITIVE, TRUE }, |
| 37 |
{ ATK_STATE_ENABLED, GTK_CELL_RENDERER_INSENSITIVE, TRUE }, |
| 38 |
{ ATK_STATE_SELECTED, GTK_CELL_RENDERER_SELECTED, FALSE }, |
| 39 |
/* XXX: why do we map ACTIVE here? */ |
| 40 |
{ ATK_STATE_ACTIVE, GTK_CELL_RENDERER_FOCUSED, FALSE }, |
| 41 |
{ ATK_STATE_FOCUSED, GTK_CELL_RENDERER_FOCUSED, FALSE }, |
| 42 |
{ ATK_STATE_EXPANDABLE,GTK_CELL_RENDERER_EXPANDABLE, FALSE }, |
| 43 |
{ ATK_STATE_EXPANDED, GTK_CELL_RENDERER_EXPANDED, FALSE }, |
| 44 |
}; |
| 45 |
|
| 46 |
static GtkCellRendererState gtk_cell_accessible_get_state (GtkCellAccessible *cell); |
| 47 |
static void atk_action_interface_init (AtkActionIface *iface); |
| 48 |
static void atk_component_interface_init (AtkComponentIface *iface); |
| 49 |
static void atk_table_cell_interface_init (AtkTableCellIface *iface); |
| 50 |
|
| 51 |
G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, gtk_cell_accessible, GTK_TYPE_ACCESSIBLE, |
| 52 |
G_ADD_PRIVATE (GtkCellAccessible) |
| 53 |
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init) |
| 54 |
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) |
| 55 |
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL, atk_table_cell_interface_init)) |
| 56 |
|
| 57 |
static gint |
| 58 |
gtk_cell_accessible_get_index_in_parent (AtkObject *obj) |
| 59 |
{ |
| 60 |
GtkCellAccessible *cell; |
| 61 |
AtkObject *parent; |
| 62 |
|
| 63 |
cell = GTK_CELL_ACCESSIBLE (obj); |
| 64 |
|
| 65 |
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) |
| 66 |
return g_list_index (gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)), obj); |
| 67 |
|
| 68 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 69 |
if (parent == NULL) |
| 70 |
return -1; |
| 71 |
|
| 72 |
return gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (cell->priv->parent), cell); |
| 73 |
} |
| 74 |
|
| 75 |
static AtkRelationSet * |
| 76 |
gtk_cell_accessible_ref_relation_set (AtkObject *object) |
| 77 |
{ |
| 78 |
GtkCellAccessible *cell; |
| 79 |
AtkRelationSet *relationset; |
| 80 |
AtkObject *parent; |
| 81 |
|
| 82 |
relationset = ATK_OBJECT_CLASS (gtk_cell_accessible_parent_class)->ref_relation_set (object); |
| 83 |
if (relationset == NULL) |
| 84 |
relationset = atk_relation_set_new (); |
| 85 |
|
| 86 |
cell = GTK_CELL_ACCESSIBLE (object); |
| 87 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 88 |
|
| 89 |
gtk_cell_accessible_parent_update_relationset (GTK_CELL_ACCESSIBLE_PARENT (parent), |
| 90 |
cell, |
| 91 |
relationset); |
| 92 |
|
| 93 |
return relationset; |
| 94 |
} |
| 95 |
|
| 96 |
static AtkStateSet * |
| 97 |
gtk_cell_accessible_ref_state_set (AtkObject *accessible) |
| 98 |
{ |
| 99 |
GtkCellAccessible *cell_accessible; |
| 100 |
AtkStateSet *state_set; |
| 101 |
GtkCellRendererState flags; |
| 102 |
guint i; |
| 103 |
|
| 104 |
cell_accessible = GTK_CELL_ACCESSIBLE (accessible); |
| 105 |
|
| 106 |
state_set = atk_state_set_new (); |
| 107 |
|
| 108 |
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)) == NULL) |
| 109 |
{ |
| 110 |
atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT); |
| 111 |
return state_set; |
| 112 |
} |
| 113 |
|
| 114 |
flags = gtk_cell_accessible_get_state (cell_accessible); |
| 115 |
|
| 116 |
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE); |
| 117 |
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE); |
| 118 |
atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT); |
| 119 |
atk_state_set_add_state (state_set, ATK_STATE_VISIBLE); |
| 120 |
|
| 121 |
for (i = 0; i < G_N_ELEMENTS (state_map); i++) |
| 122 |
{ |
| 123 |
if (flags & state_map[i].renderer_state) |
| 124 |
{ |
| 125 |
if (!state_map[i].invert) |
| 126 |
atk_state_set_add_state (state_set, state_map[i].atk_state); |
| 127 |
} |
| 128 |
else |
| 129 |
{ |
| 130 |
if (state_map[i].invert) |
| 131 |
atk_state_set_add_state (state_set, state_map[i].atk_state); |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
if (gtk_widget_get_mapped (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)))) |
| 136 |
atk_state_set_add_state (state_set, ATK_STATE_SHOWING); |
| 137 |
|
| 138 |
return state_set; |
| 139 |
} |
| 140 |
|
| 141 |
static AtkObject * |
| 142 |
gtk_cell_accessible_get_parent (AtkObject *object) |
| 143 |
{ |
| 144 |
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (object); |
| 145 |
|
| 146 |
return cell->priv->parent; |
| 147 |
} |
| 148 |
|
| 149 |
static void |
| 150 |
gtk_cell_accessible_class_init (GtkCellAccessibleClass *klass) |
| 151 |
{ |
| 152 |
AtkObjectClass *class = ATK_OBJECT_CLASS (klass); |
| 153 |
|
| 154 |
class->get_index_in_parent = gtk_cell_accessible_get_index_in_parent; |
| 155 |
class->ref_state_set = gtk_cell_accessible_ref_state_set; |
| 156 |
class->ref_relation_set = gtk_cell_accessible_ref_relation_set; |
| 157 |
class->get_parent = gtk_cell_accessible_get_parent; |
| 158 |
} |
| 159 |
|
| 160 |
static void |
| 161 |
gtk_cell_accessible_init (GtkCellAccessible *cell) |
| 162 |
{ |
| 163 |
cell->priv = gtk_cell_accessible_get_instance_private (cell); |
| 164 |
} |
| 165 |
|
| 166 |
void |
| 167 |
_gtk_cell_accessible_initialize (GtkCellAccessible *cell, |
| 168 |
GtkWidget *widget, |
| 169 |
AtkObject *parent) |
| 170 |
{ |
| 171 |
gtk_accessible_set_widget (GTK_ACCESSIBLE (cell), widget); |
| 172 |
cell->priv->parent = parent; |
| 173 |
} |
| 174 |
|
| 175 |
gboolean |
| 176 |
_gtk_cell_accessible_add_state (GtkCellAccessible *cell, |
| 177 |
AtkStateType state_type, |
| 178 |
gboolean emit_signal) |
| 179 |
{ |
| 180 |
/* The signal should only be generated if the value changed, |
| 181 |
* not when the cell is set up. So states that are set |
| 182 |
* initially should pass FALSE as the emit_signal argument. |
| 183 |
*/ |
| 184 |
if (emit_signal) |
| 185 |
{ |
| 186 |
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE); |
| 187 |
/* If state_type is ATK_STATE_VISIBLE, additional notification */ |
| 188 |
if (state_type == ATK_STATE_VISIBLE) |
| 189 |
g_signal_emit_by_name (cell, "visible-data-changed"); |
| 190 |
} |
| 191 |
|
| 192 |
/* If the parent is a flyweight container cell, propagate the state |
| 193 |
* change to it also |
| 194 |
*/ |
| 195 |
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) |
| 196 |
_gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal); |
| 197 |
|
| 198 |
return TRUE; |
| 199 |
} |
| 200 |
|
| 201 |
gboolean |
| 202 |
_gtk_cell_accessible_remove_state (GtkCellAccessible *cell, |
| 203 |
AtkStateType state_type, |
| 204 |
gboolean emit_signal) |
| 205 |
{ |
| 206 |
/* The signal should only be generated if the value changed, |
| 207 |
* not when the cell is set up. So states that are set |
| 208 |
* initially should pass FALSE as the emit_signal argument. |
| 209 |
*/ |
| 210 |
if (emit_signal) |
| 211 |
{ |
| 212 |
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE); |
| 213 |
/* If state_type is ATK_STATE_VISIBLE, additional notification */ |
| 214 |
if (state_type == ATK_STATE_VISIBLE) |
| 215 |
g_signal_emit_by_name (cell, "visible-data-changed"); |
| 216 |
} |
| 217 |
|
| 218 |
/* If the parent is a flyweight container cell, propagate the state |
| 219 |
* change to it also |
| 220 |
*/ |
| 221 |
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)) |
| 222 |
_gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal); |
| 223 |
|
| 224 |
return TRUE; |
| 225 |
} |
| 226 |
|
| 227 |
static gint |
| 228 |
gtk_cell_accessible_action_get_n_actions (AtkAction *action) |
| 229 |
{ |
| 230 |
return 3; |
| 231 |
} |
| 232 |
|
| 233 |
static const gchar * |
| 234 |
gtk_cell_accessible_action_get_name (AtkAction *action, |
| 235 |
gint index) |
| 236 |
{ |
| 237 |
switch (index) |
| 238 |
{ |
| 239 |
case 0: |
| 240 |
return "expand or contract"; |
| 241 |
case 1: |
| 242 |
return "edit"; |
| 243 |
case 2: |
| 244 |
return "activate"; |
| 245 |
default: |
| 246 |
return NULL; |
| 247 |
} |
| 248 |
} |
| 249 |
|
| 250 |
static const gchar * |
| 251 |
gtk_cell_accessible_action_get_localized_name (AtkAction *action, |
| 252 |
gint index) |
| 253 |
{ |
| 254 |
switch (index) |
| 255 |
{ |
| 256 |
case 0: |
| 257 |
return C_("Action name", "Expand or contract"); |
| 258 |
case 1: |
| 259 |
return C_("Action name", "Edit"); |
| 260 |
case 2: |
| 261 |
return C_("Action name", "Activate"); |
| 262 |
default: |
| 263 |
return NULL; |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
static const gchar * |
| 268 |
gtk_cell_accessible_action_get_description (AtkAction *action, |
| 269 |
gint index) |
| 270 |
{ |
| 271 |
switch (index) |
| 272 |
{ |
| 273 |
case 0: |
| 274 |
return C_("Action description", "Expands or contracts the row in the tree view containing this cell"); |
| 275 |
case 1: |
| 276 |
return C_("Action description", "Creates a widget in which the contents of the cell can be edited"); |
| 277 |
case 2: |
| 278 |
return C_("Action description", "Activates the cell"); |
| 279 |
default: |
| 280 |
return NULL; |
| 281 |
} |
| 282 |
} |
| 283 |
|
| 284 |
static const gchar * |
| 285 |
gtk_cell_accessible_action_get_keybinding (AtkAction *action, |
| 286 |
gint index) |
| 287 |
{ |
| 288 |
return NULL; |
| 289 |
} |
| 290 |
|
| 291 |
static gboolean |
| 292 |
gtk_cell_accessible_action_do_action (AtkAction *action, |
| 293 |
gint index) |
| 294 |
{ |
| 295 |
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action); |
| 296 |
GtkCellAccessibleParent *parent; |
| 297 |
|
| 298 |
cell = GTK_CELL_ACCESSIBLE (action); |
| 299 |
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)) == NULL) |
| 300 |
return FALSE; |
| 301 |
|
| 302 |
parent = GTK_CELL_ACCESSIBLE_PARENT (gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)))); |
| 303 |
|
| 304 |
switch (index) |
| 305 |
{ |
| 306 |
case 0: |
| 307 |
gtk_cell_accessible_parent_expand_collapse (parent, cell); |
| 308 |
break; |
| 309 |
case 1: |
| 310 |
gtk_cell_accessible_parent_edit (parent, cell); |
| 311 |
break; |
| 312 |
case 2: |
| 313 |
gtk_cell_accessible_parent_activate (parent, cell); |
| 314 |
break; |
| 315 |
default: |
| 316 |
return FALSE; |
| 317 |
} |
| 318 |
|
| 319 |
return TRUE; |
| 320 |
} |
| 321 |
|
| 322 |
static void |
| 323 |
atk_action_interface_init (AtkActionIface *iface) |
| 324 |
{ |
| 325 |
iface->get_n_actions = gtk_cell_accessible_action_get_n_actions; |
| 326 |
iface->do_action = gtk_cell_accessible_action_do_action; |
| 327 |
iface->get_name = gtk_cell_accessible_action_get_name; |
| 328 |
iface->get_localized_name = gtk_cell_accessible_action_get_localized_name; |
| 329 |
iface->get_description = gtk_cell_accessible_action_get_description; |
| 330 |
iface->get_keybinding = gtk_cell_accessible_action_get_keybinding; |
| 331 |
} |
| 332 |
|
| 333 |
static void |
| 334 |
gtk_cell_accessible_get_extents (AtkComponent *component, |
| 335 |
gint *x, |
| 336 |
gint *y, |
| 337 |
gint *width, |
| 338 |
gint *height, |
| 339 |
AtkCoordType coord_type) |
| 340 |
{ |
| 341 |
GtkCellAccessible *cell; |
| 342 |
AtkObject *parent; |
| 343 |
|
| 344 |
cell = GTK_CELL_ACCESSIBLE (component); |
| 345 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 346 |
|
| 347 |
gtk_cell_accessible_parent_get_cell_extents (GTK_CELL_ACCESSIBLE_PARENT (parent), |
| 348 |
cell, |
| 349 |
x, y, width, height, coord_type); |
| 350 |
} |
| 351 |
|
| 352 |
static gboolean |
| 353 |
gtk_cell_accessible_grab_focus (AtkComponent *component) |
| 354 |
{ |
| 355 |
GtkCellAccessible *cell; |
| 356 |
AtkObject *parent; |
| 357 |
|
| 358 |
cell = GTK_CELL_ACCESSIBLE (component); |
| 359 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 360 |
|
| 361 |
return gtk_cell_accessible_parent_grab_focus (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); |
| 362 |
} |
| 363 |
|
| 364 |
static void |
| 365 |
atk_component_interface_init (AtkComponentIface *iface) |
| 366 |
{ |
| 367 |
iface->get_extents = gtk_cell_accessible_get_extents; |
| 368 |
iface->grab_focus = gtk_cell_accessible_grab_focus; |
| 369 |
} |
| 370 |
|
| 371 |
static int |
| 372 |
gtk_cell_accessible_get_column_span (AtkTableCell *table_cell) |
| 373 |
{ |
| 374 |
return 1; |
| 375 |
} |
| 376 |
|
| 377 |
static GPtrArray * |
| 378 |
gtk_cell_accessible_get_column_header_cells (AtkTableCell *table_cell) |
| 379 |
{ |
| 380 |
GtkCellAccessible *cell; |
| 381 |
AtkObject *parent; |
| 382 |
|
| 383 |
cell = GTK_CELL_ACCESSIBLE (table_cell); |
| 384 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 385 |
|
| 386 |
return gtk_cell_accessible_parent_get_column_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent), |
| 387 |
cell); |
| 388 |
} |
| 389 |
|
| 390 |
static gboolean |
| 391 |
gtk_cell_accessible_get_position (AtkTableCell *table_cell, |
| 392 |
gint *row, |
| 393 |
gint *column) |
| 394 |
{ |
| 395 |
GtkCellAccessible *cell; |
| 396 |
AtkObject *parent; |
| 397 |
|
| 398 |
cell = GTK_CELL_ACCESSIBLE (table_cell); |
| 399 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 400 |
|
| 401 |
gtk_cell_accessible_parent_get_cell_position (GTK_CELL_ACCESSIBLE_PARENT (parent), |
| 402 |
cell, |
| 403 |
row, column); |
| 404 |
return ((row && *row >= 0) || (column && *column >= 0)); |
| 405 |
} |
| 406 |
|
| 407 |
static int |
| 408 |
gtk_cell_accessible_get_row_span (AtkTableCell *table_cell) |
| 409 |
{ |
| 410 |
return 1; |
| 411 |
} |
| 412 |
|
| 413 |
static GPtrArray * |
| 414 |
gtk_cell_accessible_get_row_header_cells (AtkTableCell *table_cell) |
| 415 |
{ |
| 416 |
GtkCellAccessible *cell; |
| 417 |
AtkObject *parent; |
| 418 |
|
| 419 |
cell = GTK_CELL_ACCESSIBLE (table_cell); |
| 420 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 421 |
|
| 422 |
return gtk_cell_accessible_parent_get_row_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent), |
| 423 |
cell); |
| 424 |
} |
| 425 |
|
| 426 |
static AtkObject * |
| 427 |
gtk_cell_accessible_get_table (AtkTableCell *table_cell) |
| 428 |
{ |
| 429 |
AtkObject *obj; |
| 430 |
|
| 431 |
obj = ATK_OBJECT (table_cell); |
| 432 |
do |
| 433 |
{ |
| 434 |
AtkRole role; |
| 435 |
obj = atk_object_get_parent (obj); |
| 436 |
role = atk_object_get_role (obj); |
| 437 |
if (role == ATK_ROLE_TABLE || role == ATK_ROLE_TREE_TABLE) |
| 438 |
break; |
| 439 |
} |
| 440 |
while (obj); |
| 441 |
return obj; |
| 442 |
} |
| 443 |
|
| 444 |
static void |
| 445 |
atk_table_cell_interface_init (AtkTableCellIface *iface) |
| 446 |
{ |
| 447 |
iface->get_column_span = gtk_cell_accessible_get_column_span; |
| 448 |
iface->get_column_header_cells = gtk_cell_accessible_get_column_header_cells; |
| 449 |
iface->get_position = gtk_cell_accessible_get_position; |
| 450 |
iface->get_row_span = gtk_cell_accessible_get_row_span; |
| 451 |
iface->get_row_header_cells = gtk_cell_accessible_get_row_header_cells; |
| 452 |
iface->get_table = gtk_cell_accessible_get_table; |
| 453 |
} |
| 454 |
|
| 455 |
static GtkCellRendererState |
| 456 |
gtk_cell_accessible_get_state (GtkCellAccessible *cell) |
| 457 |
{ |
| 458 |
AtkObject *parent; |
| 459 |
|
| 460 |
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0); |
| 461 |
|
| 462 |
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))); |
| 463 |
if (parent == NULL) |
| 464 |
return 0; |
| 465 |
|
| 466 |
return gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell); |
| 467 |
} |
| 468 |
|
| 469 |
/* |
| 470 |
* gtk_cell_accessible_state_changed: |
| 471 |
* @cell: a #GtkCellAccessible |
| 472 |
* @added: the flags that were added from @cell |
| 473 |
* @removed: the flags that were removed from @cell |
| 474 |
* |
| 475 |
* Notifies @cell of state changes. Multiple states may be added |
| 476 |
* or removed at the same time. A state that is @added may not be |
| 477 |
* @removed at the same time. |
| 478 |
**/ |
| 479 |
void |
| 480 |
_gtk_cell_accessible_state_changed (GtkCellAccessible *cell, |
| 481 |
GtkCellRendererState added, |
| 482 |
GtkCellRendererState removed) |
| 483 |
{ |
| 484 |
AtkObject *object; |
| 485 |
guint i; |
| 486 |
|
| 487 |
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell)); |
| 488 |
g_return_if_fail ((added & removed) == 0); |
| 489 |
|
| 490 |
object = ATK_OBJECT (cell); |
| 491 |
|
| 492 |
for (i = 0; i < G_N_ELEMENTS (state_map); i++) |
| 493 |
{ |
| 494 |
if (added & state_map[i].renderer_state) |
| 495 |
atk_object_notify_state_change (object, |
| 496 |
state_map[i].atk_state, |
| 497 |
!state_map[i].invert); |
| 498 |
if (removed & state_map[i].renderer_state) |
| 499 |
atk_object_notify_state_change (object, |
| 500 |
state_map[i].atk_state, |
| 501 |
state_map[i].invert); |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
/* |
| 506 |
* gtk_cell_accessible_update_cache: |
| 507 |
* @cell: the cell that is changed |
| 508 |
* @emit_signal: whether or not to notify the ATK bridge |
| 509 |
* |
| 510 |
* Notifies the cell that the values in the data in the row that |
| 511 |
* is used to feed the cell renderer with has changed. The |
| 512 |
* cell_changed function of @cell is called to send update |
| 513 |
* notifications for the properties it takes from its cell |
| 514 |
* renderer. If @emit_signal is TRUE, also notify the ATK bridge |
| 515 |
* of the change. The bridge should be notified when an existing |
| 516 |
* cell changes; not when a newly-created cell is being set up. |
| 517 |
* |
| 518 |
* Note that there is no higher granularity available about which |
| 519 |
* properties changed, so you will need to make do with this |
| 520 |
* function. |
| 521 |
**/ |
| 522 |
void |
| 523 |
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell, |
| 524 |
gboolean emit_signal) |
| 525 |
{ |
| 526 |
GtkCellAccessibleClass *klass; |
| 527 |
|
| 528 |
g_return_if_fail (GTK_CELL_ACCESSIBLE (cell)); |
| 529 |
|
| 530 |
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell); |
| 531 |
|
| 532 |
if (klass->update_cache) |
| 533 |
klass->update_cache (cell, emit_signal); |
| 534 |
} |