1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
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.
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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
22 #include <glib-object.h>
25 #include "atkmarshal.h"
27 /* New GObject properties registered by AtkObject */
30 PROP_0, /* gobject convention */
34 PROP_PARENT, /* ancestry has changed */
40 PROP_TABLE_COLUMN_DESCRIPTION,
41 PROP_TABLE_COLUMN_HEADER,
42 PROP_TABLE_ROW_DESCRIPTION,
43 PROP_TABLE_ROW_HEADER,
45 PROP_LAST /* gobject convention */
58 static void atk_object_class_init (AtkObjectClass *klass);
59 static void atk_object_init (AtkObject *accessible,
60 AtkObjectClass *klass);
61 static AtkRelationSet* atk_object_real_ref_relation_set
62 (AtkObject *accessible);
64 static void atk_object_real_set_property (GObject *object,
68 static void atk_object_real_get_property (GObject *object,
72 static void atk_object_finalize (GObject *object);
73 static G_CONST_RETURN gchar*
74 atk_object_real_get_name (AtkObject *object);
75 static G_CONST_RETURN gchar*
76 atk_object_real_get_description
78 static AtkObject* atk_object_real_get_parent (AtkObject *object);
79 static AtkRole atk_object_real_get_role (AtkObject *object);
80 static AtkLayer atk_object_real_get_layer (AtkObject *object);
81 static AtkStateSet* atk_object_real_ref_state_set
83 static void atk_object_real_set_name (AtkObject *object,
85 static void atk_object_real_set_description
87 const gchar *description);
88 static void atk_object_real_set_parent (AtkObject *object,
90 static void atk_object_real_set_role (AtkObject *object,
92 static guint atk_object_real_connect_property_change_handler
94 AtkPropertyChangeHandler
96 static void atk_object_real_remove_property_change_handler
99 static void atk_object_notify (GObject *obj,
103 static guint atk_object_signals[LAST_SIGNAL] = { 0, };
105 static gpointer parent_class = NULL;
107 static const gchar* atk_object_name_property_name = "accessible-name";
108 static const gchar* atk_object_name_property_description = "accessible-description";
109 static const gchar* atk_object_name_property_parent = "accessible-parent";
110 static const gchar* atk_object_name_property_value = "accessible-value";
111 static const gchar* atk_object_name_property_role = "accessible-role";
112 static const gchar* atk_object_name_property_component_layer = "accessible-component-layer";
113 static const gchar* atk_object_name_property_component_mdi_zorder = "accessible-component-mdi-zorder";
114 static const gchar* atk_object_name_property_table_caption = "accessible-table-caption";
115 static const gchar* atk_object_name_property_table_column_description = "accessible-table-column-description";
116 static const gchar* atk_object_name_property_table_column_header = "accessible-table-column-header";
117 static const gchar* atk_object_name_property_table_row_description = "accessible-table-row-description";
118 static const gchar* atk_object_name_property_table_row_header = "accessible-table-row-header";
119 static const gchar* atk_object_name_property_table_summary = "accessible-table-summary";
122 atk_object_get_type (void)
124 static GType type = 0;
128 static const GTypeInfo typeInfo =
130 sizeof (AtkObjectClass),
131 (GBaseInitFunc) NULL,
132 (GBaseFinalizeFunc) NULL,
133 (GClassInitFunc) atk_object_class_init,
134 (GClassFinalizeFunc) NULL,
138 (GInstanceInitFunc) atk_object_init,
140 type = g_type_register_static (G_TYPE_OBJECT, "AtkObject", &typeInfo, 0) ;
146 atk_object_class_init (AtkObjectClass *klass)
148 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
150 parent_class = g_type_class_ref (G_TYPE_OBJECT);
152 gobject_class->set_property = atk_object_real_set_property;
153 gobject_class->get_property = atk_object_real_get_property;
154 gobject_class->finalize = atk_object_finalize;
155 gobject_class->notify = atk_object_notify;
157 klass->get_name = atk_object_real_get_name;
158 klass->get_description = atk_object_real_get_description;
159 klass->get_parent = atk_object_real_get_parent;
160 klass->get_n_children = NULL;
161 klass->ref_child = NULL;
162 klass->get_index_in_parent = NULL;
163 klass->ref_relation_set = atk_object_real_ref_relation_set;
164 klass->get_role = atk_object_real_get_role;
165 klass->get_layer = atk_object_real_get_layer;
166 klass->get_mdi_zorder = NULL;
167 klass->ref_state_set = atk_object_real_ref_state_set;
168 klass->set_name = atk_object_real_set_name;
169 klass->set_description = atk_object_real_set_description;
170 klass->set_parent = atk_object_real_set_parent;
171 klass->set_role = atk_object_real_set_role;
172 klass->connect_property_change_handler =
173 atk_object_real_connect_property_change_handler;
174 klass->remove_property_change_handler =
175 atk_object_real_remove_property_change_handler;
178 * We do not define default signal handlers here
180 klass->children_changed = NULL;
181 klass->focus_event = NULL;
182 klass->property_change = NULL;
183 klass->visible_data_changed = NULL;
185 g_object_class_install_property (gobject_class,
187 g_param_spec_string (atk_object_name_property_name,
189 "Object instance\'s name formatted for "
190 "assistive technology access",
193 g_object_class_install_property (gobject_class,
195 g_param_spec_string (atk_object_name_property_description,
196 "Accessible Description",
197 "Description of an object, formatted for "
198 "assistive technology access",
201 g_object_class_install_property (gobject_class,
203 g_param_spec_object (atk_object_name_property_parent,
205 "Is used to notify that the parent has changed ",
208 g_object_class_install_property (gobject_class,
210 g_param_spec_double (atk_object_name_property_value,
212 "Is used to notify that the value has changed ",
217 g_object_class_install_property (gobject_class,
219 g_param_spec_int (atk_object_name_property_role,
221 "The accessible role of this object ",
226 g_object_class_install_property (gobject_class,
228 g_param_spec_int (atk_object_name_property_component_layer,
230 "The accessible layer of this object ",
235 g_object_class_install_property (gobject_class,
237 g_param_spec_int (atk_object_name_property_component_mdi_zorder,
238 "Accessible MDI Value",
239 "The accessible MDI value of this object ",
244 g_object_class_install_property (gobject_class,
246 g_param_spec_string (atk_object_name_property_table_caption,
247 "Accessible Table Caption",
248 "Is used to notify that the table caption has changed ",
251 g_object_class_install_property (gobject_class,
252 PROP_TABLE_COLUMN_HEADER,
253 g_param_spec_object (atk_object_name_property_table_column_header,
254 "Accessible Table Column Header",
255 "Is used to notify that the table column header has changed ",
258 g_object_class_install_property (gobject_class,
259 PROP_TABLE_COLUMN_DESCRIPTION,
260 g_param_spec_string (atk_object_name_property_table_column_description,
261 "Accessible Table Column Description",
262 "Is used to notify that the table columnscription has changed ",
265 g_object_class_install_property (gobject_class,
266 PROP_TABLE_ROW_HEADER,
267 g_param_spec_object (atk_object_name_property_table_row_header,
268 "Accessible Table Row Header",
269 "Is used to notify that the table row header has changed ",
272 g_object_class_install_property (gobject_class,
273 PROP_TABLE_ROW_DESCRIPTION,
274 g_param_spec_string (atk_object_name_property_table_row_description,
275 "Accessible Table Row Description",
276 "Is used to notify that the table row description has changed ",
279 g_object_class_install_property (gobject_class,
281 g_param_spec_object (atk_object_name_property_table_summary,
282 "Accessible Table Summary",
283 "Is used to notify that the table summary has changed ",
287 * The signal "children_changed" supports two details:
290 atk_object_signals[CHILDREN_CHANGED] =
291 g_signal_new ("children_changed",
292 G_TYPE_FROM_CLASS (klass),
293 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
294 G_STRUCT_OFFSET (AtkObjectClass, children_changed),
296 g_cclosure_marshal_VOID__UINT_POINTER,
298 2, G_TYPE_UINT, G_TYPE_POINTER);
299 atk_object_signals[FOCUS_EVENT] =
300 g_signal_new ("focus_event",
301 G_TYPE_FROM_CLASS (klass),
303 G_STRUCT_OFFSET (AtkObjectClass, focus_event),
305 g_cclosure_marshal_VOID__BOOLEAN,
308 atk_object_signals[PROPERTY_CHANGE] =
309 g_signal_new ("property_change",
310 G_TYPE_FROM_CLASS (klass),
311 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
312 G_STRUCT_OFFSET (AtkObjectClass, property_change),
313 (GSignalAccumulator) NULL, NULL,
314 g_cclosure_marshal_VOID__POINTER,
318 * The "state_change" signal supports details, one for each accessible
322 atk_object_signals[STATE_CHANGE] =
323 g_signal_new ("state_change",
324 G_TYPE_FROM_CLASS (klass),
325 G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
326 G_STRUCT_OFFSET (AtkObjectClass, state_change),
327 (GSignalAccumulator) NULL, NULL,
328 atk_marshal_VOID__STRING_BOOLEAN,
332 atk_object_signals[VISIBLE_DATA_CHANGED] =
333 g_signal_new ("visible_data_changed",
334 G_TYPE_FROM_CLASS (klass),
336 G_STRUCT_OFFSET (AtkObjectClass, visible_data_changed),
337 (GSignalAccumulator) NULL, NULL,
338 g_cclosure_marshal_VOID__VOID,
343 atk_object_init (AtkObject *accessible,
344 AtkObjectClass *klass)
346 accessible->name = NULL;
347 accessible->description = NULL;
348 accessible->accessible_parent = NULL;
349 accessible->relation_set = atk_relation_set_new();
350 accessible->role = ATK_ROLE_UNKNOWN;
354 atk_implementor_get_type (void)
356 static GType type = 0;
360 static const GTypeInfo typeInfo =
362 sizeof (AtkImplementorIface),
363 (GBaseInitFunc) NULL,
364 (GBaseFinalizeFunc) NULL,
367 type = g_type_register_static (G_TYPE_INTERFACE, "AtkImplementorIface", &typeInfo, 0) ;
374 * atk_object_get_name:
375 * @accessible: an #AtkObject
377 * Gets the accessible name of the accessible.
379 * Returns: a character string representing the accessible name of the object.
381 G_CONST_RETURN gchar*
382 atk_object_get_name (AtkObject *accessible)
384 AtkObjectClass *klass;
386 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
388 klass = ATK_OBJECT_GET_CLASS (accessible);
390 return (klass->get_name) (accessible);
396 * atk_object_get_description:
397 * @accessible: an #AtkObject
399 * Gets the accessible description of the accessible.
401 * Returns: a character string representing the accessible description
405 G_CONST_RETURN gchar*
406 atk_object_get_description (AtkObject *accessible)
408 AtkObjectClass *klass;
410 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
412 klass = ATK_OBJECT_GET_CLASS (accessible);
413 if (klass->get_description)
414 return (klass->get_description) (accessible);
420 * atk_object_get_parent:
421 * @accessible: an #AtkObject
423 * Gets the accessible parent of the accessible.
425 * Returns: a #AtkObject representing the accessible parent of the accessible
428 atk_object_get_parent (AtkObject *accessible)
430 AtkObjectClass *klass;
432 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
434 klass = ATK_OBJECT_GET_CLASS (accessible);
435 if (klass->get_parent)
436 return (klass->get_parent) (accessible);
442 * atk_object_get_n_accessible_children:
443 * @accessible: an #AtkObject
445 * Gets the number of accessible children of the accessible.
447 * Returns: an integer representing the number of accessible children
451 atk_object_get_n_accessible_children (AtkObject *accessible)
453 AtkObjectClass *klass;
455 g_return_val_if_fail (ATK_IS_OBJECT (accessible), 0);
457 klass = ATK_OBJECT_GET_CLASS (accessible);
458 if (klass->get_n_children)
459 return (klass->get_n_children) (accessible);
465 * atk_object_ref_accessible_child:
466 * @accessible: an #AtkObject
467 * @i: a gint representing the position of the child, starting from 0
469 * Gets a reference to the specified accessible child of the object.
470 * The accessible children are 0-based so the first accessible child is
471 * at index 0, the second at index 1 and so on.
473 * Returns: an #AtkObject representing the specified accessible child
477 atk_object_ref_accessible_child (AtkObject *accessible,
480 AtkObjectClass *klass;
482 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
484 klass = ATK_OBJECT_GET_CLASS (accessible);
485 if (klass->ref_child)
486 return (klass->ref_child) (accessible, i);
492 * atk_object_ref_relation_set:
493 * @accessible: an #AtkObject
495 * Gets the #AtkRelationSet associated with the object.
497 * Returns: an #AtkRelationSet representing the relation set of the object.
500 atk_object_ref_relation_set (AtkObject *accessible)
502 AtkObjectClass *klass;
504 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
506 klass = ATK_OBJECT_GET_CLASS (accessible);
507 if (klass->ref_relation_set)
508 return (klass->ref_relation_set) (accessible);
515 * @name: a character string describing the new role.
517 * Registers the role specified by @name.
519 * Returns: an #AtkRole for the new role.
522 atk_role_register (const gchar *name)
524 /* TODO: associate name with new type */
525 static guint type = ATK_ROLE_LAST_DEFINED;
530 * atk_object_get_role:
531 * @accessible: an #AtkObject
533 * Gets the role of the accessible.
535 * Returns: an #AtkRole which is the role of the accessible
538 atk_object_get_role (AtkObject *accessible)
540 AtkObjectClass *klass;
542 g_return_val_if_fail (ATK_IS_OBJECT (accessible), ATK_ROLE_UNKNOWN);
544 klass = ATK_OBJECT_GET_CLASS (accessible);
546 return (klass->get_role) (accessible);
548 return ATK_ROLE_UNKNOWN;
552 * atk_object_get_layer:
553 * @accessible: an #AtkObject
555 * Gets the layer of the accessible.
557 * Returns: an #AtkLayer which is the layer of the accessible
560 atk_object_get_layer (AtkObject *accessible)
562 AtkObjectClass *klass;
564 g_return_val_if_fail (ATK_IS_OBJECT (accessible), ATK_LAYER_INVALID);
566 klass = ATK_OBJECT_GET_CLASS (accessible);
567 if (klass->get_layer)
568 return (klass->get_layer) (accessible);
570 return ATK_LAYER_INVALID;
574 * atk_object_get_mdi_zorder:
575 * @accessible: an #AtkObject
577 * Gets the zorder of the accessible. The value G_MININT will be returned
578 * if the layer of the accessible is not ATK_LAYER_MDI.
580 * Returns: a gint which is the zorder of the accessible, i.e. the depth at
581 * which the component is shown in relation to other components in the same
585 atk_object_get_mdi_zorder (AtkObject *accessible)
587 AtkObjectClass *klass;
589 g_return_val_if_fail (ATK_IS_OBJECT (accessible), G_MININT);
591 klass = ATK_OBJECT_GET_CLASS (accessible);
592 if (klass->get_mdi_zorder)
593 return (klass->get_mdi_zorder) (accessible);
599 * atk_object_ref_state_set:
600 * @accessible: an #AtkObject
602 * Gets a reference to the state set of the accessible; the caller must
603 * unreference it when it is no longer needed.
605 * Returns: a reference to an #AtkStateSet which is the state
606 * set of the accessible
609 atk_object_ref_state_set (AtkObject *accessible)
611 AtkObjectClass *klass;
613 g_return_val_if_fail (ATK_IS_OBJECT (accessible), NULL);
615 klass = ATK_OBJECT_GET_CLASS (accessible);
616 if (klass->ref_state_set)
617 return (klass->ref_state_set) (accessible);
623 * atk_object_get_index_in_parent:
624 * @accessible: an #AtkObject
626 * Gets the 0-based index of this accessible in its parent; returns -1 if the
627 * accessible does not have an accessible parent.
629 * Returns: an integer which is the index of the accessible in its parent
632 atk_object_get_index_in_parent (AtkObject *accessible)
634 AtkObjectClass *klass;
636 g_return_val_if_fail (ATK_OBJECT (accessible), -1);
638 klass = ATK_OBJECT_GET_CLASS (accessible);
639 if (klass->get_index_in_parent)
640 return (klass->get_index_in_parent) (accessible);
646 * atk_object_set_name:
647 * @accessible: an #AtkObject
648 * @name: a character string to be set as the accessible name
650 * Sets the accessible name of the accessible.
653 atk_object_set_name (AtkObject *accessible,
656 AtkObjectClass *klass;
658 g_return_if_fail (ATK_IS_OBJECT (accessible));
659 g_return_if_fail (name != NULL);
661 klass = ATK_OBJECT_GET_CLASS (accessible);
664 (klass->set_name) (accessible, name);
665 g_object_notify (G_OBJECT (accessible), atk_object_name_property_name);
670 * atk_object_set_description:
671 * @accessible: an #AtkObject
672 * @description : a character string to be set as the accessible description
674 * Sets the accessible description of the accessible.
677 atk_object_set_description (AtkObject *accessible,
678 const gchar *description)
680 AtkObjectClass *klass;
682 g_return_if_fail (ATK_IS_OBJECT (accessible));
683 g_return_if_fail (description != NULL);
685 klass = ATK_OBJECT_GET_CLASS (accessible);
686 if (klass->set_description)
688 (klass->set_description) (accessible, description);
689 g_object_notify (G_OBJECT (accessible), atk_object_name_property_description);
694 * atk_object_set_parent:
695 * @accessible: an #AtkObject
696 * @parent : an #AtkObject to be set as the accessible parent
698 * Sets the accessible parent of the accessible.
701 atk_object_set_parent (AtkObject *accessible,
704 AtkObjectClass *klass;
706 g_return_if_fail (ATK_IS_OBJECT (accessible));
708 klass = ATK_OBJECT_GET_CLASS (accessible);
709 if (klass->set_parent)
711 (klass->set_parent) (accessible, parent);
712 g_object_notify (G_OBJECT (accessible), atk_object_name_property_parent);
717 * atk_object_set_role:
718 * @accessible: an #AtkObject
719 * @role : an #AtkRole to be set as the role
721 * Sets the role of the accessible.
724 atk_object_set_role (AtkObject *accessible,
727 AtkObjectClass *klass;
729 g_return_if_fail (ATK_IS_OBJECT (accessible));
731 klass = ATK_OBJECT_GET_CLASS (accessible);
734 (klass->set_role) (accessible, role);
735 g_object_notify (G_OBJECT (accessible), atk_object_name_property_role);
740 * atk_object_connect_property_change_handler:
741 * @accessible: an #AtkObject
742 * @handler : a function to be called when a property changes its value
744 * Specifies a function to be called when a property changes value.
746 * Returns: a #guint which is the handler id used in
747 * atk_object_remove_property_change_handler()
750 atk_object_connect_property_change_handler (AtkObject *accessible,
751 AtkPropertyChangeHandler *handler)
753 AtkObjectClass *klass;
755 g_return_val_if_fail (ATK_IS_OBJECT (accessible), 0);
756 g_return_val_if_fail ((handler != NULL), 0);
758 klass = ATK_OBJECT_GET_CLASS (accessible);
759 if (klass->connect_property_change_handler)
760 return (klass->connect_property_change_handler) (accessible, handler);
766 * atk_object_remove_property_change_handler:
767 * @accessible: an #AtkObject
768 * @handler_id : a guint which identifies the handler to be removed.
770 * Removes a property change handler.
773 atk_object_remove_property_change_handler (AtkObject *accessible,
776 AtkObjectClass *klass;
778 g_return_if_fail (ATK_IS_OBJECT (accessible));
780 klass = ATK_OBJECT_GET_CLASS (accessible);
781 if (klass->remove_property_change_handler)
782 (klass->remove_property_change_handler) (accessible, handler_id);
786 * atk_object_notify_state_change:
787 * @accessible: an #AtkObject
788 * @state: an #AtkState whose state is changed
789 * @value : a gboolean which indicates whether the state is being set on or off
791 * Emits a state-change signal for the specified state.
794 atk_object_notify_state_change (AtkObject *accessible,
798 G_CONST_RETURN gchar* name;
800 name = atk_state_type_get_name (state);
801 g_signal_emit (accessible, atk_object_signals[STATE_CHANGE],
802 g_quark_from_string (name),
807 * atk_implementor_ref_accessible:
808 * @implementor: The #GObject instance which should implement #AtkImplementorIface
809 * if a non-null return value is required.
811 * Gets a reference to an object's #AtkObject implementation, if
812 * the object implements #AtkObjectIface
814 * Returns: a reference to an object's #AtkObject implementation
817 atk_implementor_ref_accessible (AtkImplementor *object)
819 AtkImplementorIface *iface;
820 AtkObject *accessible = NULL;
822 g_return_val_if_fail (ATK_IS_IMPLEMENTOR (object), NULL);
824 iface = ATK_IMPLEMENTOR_GET_IFACE (object);
827 accessible = iface->ref_accessible (object);
829 g_return_val_if_fail ((accessible != NULL), NULL);
834 static AtkRelationSet*
835 atk_object_real_ref_relation_set (AtkObject *accessible)
837 g_return_val_if_fail (accessible->relation_set, NULL);
838 g_object_ref (accessible->relation_set);
840 return accessible->relation_set;
844 atk_object_real_set_property (GObject *object,
849 AtkObject *accessible;
851 accessible = ATK_OBJECT (object);
856 atk_object_set_name (accessible, g_value_get_string (value));
858 case PROP_DESCRIPTION:
859 atk_object_set_description (accessible, g_value_get_string (value));
862 atk_object_set_role (accessible, g_value_get_int (value));
865 atk_object_set_parent (accessible, g_value_get_object (value));
868 if (ATK_IS_VALUE (accessible))
869 atk_value_set_current_value (ATK_VALUE (accessible), value);
877 atk_object_real_get_property (GObject *object,
882 AtkObject *accessible;
884 accessible = ATK_OBJECT (object);
889 g_value_set_string (value, atk_object_get_name (accessible));
891 case PROP_DESCRIPTION:
892 g_value_set_string (value, atk_object_get_description (accessible));
895 g_value_set_int (value, atk_object_get_role (accessible));
898 g_value_set_int (value, atk_object_get_role (accessible));
900 case PROP_MDI_ZORDER:
901 g_value_set_int (value, atk_object_get_mdi_zorder (accessible));
904 g_value_set_object (value, atk_object_get_parent (accessible));
907 if (ATK_IS_VALUE (accessible))
908 atk_value_get_current_value (ATK_VALUE (accessible), value);
911 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
917 atk_object_finalize (GObject *object)
919 AtkObject *accessible;
921 g_return_if_fail (ATK_IS_OBJECT (object));
923 accessible = ATK_OBJECT (object);
925 g_free (accessible->name);
926 g_free (accessible->description);
929 * Free memory allocated for relation set if it have been allocated.
931 if (accessible->relation_set)
932 g_object_unref (accessible->relation_set);
934 if (accessible->accessible_parent)
935 g_object_unref (accessible->accessible_parent);
937 G_OBJECT_CLASS (parent_class)->finalize (object);
940 static G_CONST_RETURN gchar*
941 atk_object_real_get_name (AtkObject *object)
946 static G_CONST_RETURN gchar*
947 atk_object_real_get_description (AtkObject *object)
949 return object->description;
953 atk_object_real_get_parent (AtkObject *object)
955 return object->accessible_parent;
959 atk_object_real_get_role (AtkObject *object)
965 atk_object_real_get_layer (AtkObject *object)
967 return object->layer;
971 atk_object_real_ref_state_set (AtkObject *accessible)
973 AtkStateSet *state_set;
976 state_set = atk_state_set_new ();
978 ap = atk_object_get_parent (accessible);
980 if (ATK_IS_SELECTION (ap))
984 atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
986 i = atk_object_get_index_in_parent (accessible);
988 if (atk_selection_is_child_selected(ATK_SELECTION (ap), i))
989 atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
996 atk_object_real_set_name (AtkObject *object,
999 g_free (object->name);
1000 object->name = g_strdup (name);
1004 atk_object_real_set_description (AtkObject *object,
1005 const gchar *description)
1007 g_free (object->description);
1008 object->description = g_strdup (description);
1012 atk_object_real_set_parent (AtkObject *object,
1015 if (object->accessible_parent)
1016 g_object_unref (object->accessible_parent);
1018 object->accessible_parent = parent;
1019 if (object->accessible_parent)
1020 g_object_ref (object->accessible_parent);
1024 atk_object_real_set_role (AtkObject *object,
1027 object->role = role;
1031 atk_object_real_connect_property_change_handler (AtkObject *obj,
1032 AtkPropertyChangeHandler *handler)
1034 return g_signal_connect_closure_by_id (obj,
1035 atk_object_signals[PROPERTY_CHANGE],
1038 G_CALLBACK (handler), NULL,
1039 (GClosureNotify) NULL),
1044 atk_object_real_remove_property_change_handler (AtkObject *obj,
1047 g_signal_handler_disconnect (obj, handler_id);
1051 * This function is a signal handler for notify signal which gets emitted
1052 * when a property changes value.
1054 * It constructs an AtkPropertyValues structure and emits a "property_changed"
1055 * signal which causes the user specified AtkPropertyChangeHandler
1059 atk_object_notify (GObject *obj,
1062 AtkPropertyValues values = { 0, };
1064 g_value_init (&values.new_value, pspec->value_type);
1065 g_object_get_property (obj, pspec->name, &values.new_value);
1066 values.property_name = pspec->name;
1067 g_signal_emit (obj, atk_object_signals[PROPERTY_CHANGE],
1068 g_quark_from_string (pspec->name),