2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = AtkObject.html
47 * - AtkStateSet* -> StateSet
58 import tango
.io
.Stdout
; // use the tango loging?
62 private import gtkc
.atktypes
;
64 private import gtkc
.atk
;
67 private import glib
.Str
;
68 private import atk
.StateSet
;
75 * This class is the primary class for accessibility support via
76 * the Accessibility ToolKit (ATK). Objects which are instances
77 * of AtkObject (or instances of AtkObject-derived types) are
78 * queried for properties which relate basic (and generic) properties of a
79 * UI component such as name and description. Instances of AtkObject
80 * may also be queried as to whether they implement other ATK interfaces
81 * (e.g. AtkAction, AtkComponent, etc.), as appropriate to the role
82 * which a given UI component plays in a user interface.
83 * All UI components in an application which provide useful
84 * information or services to the user must provide corresponding
85 * AtkObject instances on request (in GTK+, for instance, usually
86 * on a call to #gtk_widget_get_accessible()), either via ATK support
87 * built into the toolkit for the widget class or ancestor class, or in
88 * the case of custom widgets, if the inherited AtkObject implementation
89 * is insufficient, via instances of a new AtkObject subclass.
91 private import gobject
.ObjectG
;
92 public class ObjectAtk
: ObjectG
95 /** the main Gtk struct */
96 protected AtkObject
* atkObject
;
99 public AtkObject
* getObjectAtkStruct()
105 /** the main Gtk struct as a void* */
106 protected void* getStruct()
108 return cast(void*)atkObject
;
112 * Sets our main struct and passes it to the parent class
114 public this (AtkObject
* atkObject
)
118 if ( atkObject
is null )
123 Stdout("struct atkObject is null on constructor").newline
;
127 printf("struct atkObject is null on constructor");
134 assert(atkObject
!is null, "struct atkObject is null on constructor");
136 super(cast(GObject
*)atkObject
);
137 this.atkObject
= atkObject
;
143 // imports for the signal processing
144 private import gobject
.Signals
;
145 private import gtkc
.gdktypes
;
146 int[char[]] connectedSignals
;
148 void delegate(gpointer
, ObjectAtk
)[] onActiveDescendantChangedListeners
;
149 void addOnActiveDescendantChanged(void delegate(gpointer
, ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
151 if ( !("active-descendant-changed" in connectedSignals
) )
155 "active-descendant-changed",
156 cast(GCallback
)&callBackActiveDescendantChanged
,
160 connectedSignals
["active-descendant-changed"] = 1;
162 onActiveDescendantChangedListeners
~= dlg
;
164 extern(C
) static void callBackActiveDescendantChanged(AtkObject
* atkobjectStruct
, gpointer arg1
, ObjectAtk objectAtk
)
166 bool consumed
= false;
168 foreach ( void delegate(gpointer
, ObjectAtk
) dlg
; objectAtk
.onActiveDescendantChangedListeners
)
170 dlg(arg1
, objectAtk
);
176 void delegate(guint
, gpointer
, ObjectAtk
)[] onChildrenChangedListeners
;
177 void addOnChildrenChanged(void delegate(guint
, gpointer
, ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
179 if ( !("children-changed" in connectedSignals
) )
184 cast(GCallback
)&callBackChildrenChanged
,
188 connectedSignals
["children-changed"] = 1;
190 onChildrenChangedListeners
~= dlg
;
192 extern(C
) static void callBackChildrenChanged(AtkObject
* atkobjectStruct
, guint arg1
, gpointer arg2
, ObjectAtk objectAtk
)
194 bool consumed
= false;
196 foreach ( void delegate(guint
, gpointer
, ObjectAtk
) dlg
; objectAtk
.onChildrenChangedListeners
)
198 dlg(arg1
, arg2
, objectAtk
);
204 void delegate(gboolean
, ObjectAtk
)[] onFocusListeners
;
205 void addOnFocus(void delegate(gboolean
, ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
207 if ( !("focus-event" in connectedSignals
) )
212 cast(GCallback
)&callBackFocus
,
216 connectedSignals
["focus-event"] = 1;
218 onFocusListeners
~= dlg
;
220 extern(C
) static void callBackFocus(AtkObject
* atkobjectStruct
, gboolean arg1
, ObjectAtk objectAtk
)
222 bool consumed
= false;
224 foreach ( void delegate(gboolean
, ObjectAtk
) dlg
; objectAtk
.onFocusListeners
)
226 dlg(arg1
, objectAtk
);
232 void delegate(gpointer
, ObjectAtk
)[] onPropertyChangeListeners
;
233 void addOnPropertyChange(void delegate(gpointer
, ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
235 if ( !("property-change" in connectedSignals
) )
240 cast(GCallback
)&callBackPropertyChange
,
244 connectedSignals
["property-change"] = 1;
246 onPropertyChangeListeners
~= dlg
;
248 extern(C
) static void callBackPropertyChange(AtkObject
* atkobjectStruct
, gpointer arg1
, ObjectAtk objectAtk
)
250 bool consumed
= false;
252 foreach ( void delegate(gpointer
, ObjectAtk
) dlg
; objectAtk
.onPropertyChangeListeners
)
254 dlg(arg1
, objectAtk
);
260 void delegate(char[], gboolean
, ObjectAtk
)[] onStateChangeListeners
;
261 void addOnStateChange(void delegate(char[], gboolean
, ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
263 if ( !("state-change" in connectedSignals
) )
268 cast(GCallback
)&callBackStateChange
,
272 connectedSignals
["state-change"] = 1;
274 onStateChangeListeners
~= dlg
;
276 extern(C
) static void callBackStateChange(AtkObject
* atkobjectStruct
, gchar
* arg1
, gboolean arg2
, ObjectAtk objectAtk
)
278 bool consumed
= false;
280 foreach ( void delegate(char[], gboolean
, ObjectAtk
) dlg
; objectAtk
.onStateChangeListeners
)
282 dlg(Str
.toString(arg1
), arg2
, objectAtk
);
288 void delegate(ObjectAtk
)[] onVisibleDataChangedListeners
;
289 void addOnVisibleDataChanged(void delegate(ObjectAtk
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
291 if ( !("visible-data-changed" in connectedSignals
) )
295 "visible-data-changed",
296 cast(GCallback
)&callBackVisibleDataChanged
,
300 connectedSignals
["visible-data-changed"] = 1;
302 onVisibleDataChangedListeners
~= dlg
;
304 extern(C
) static void callBackVisibleDataChanged(AtkObject
* atkobjectStruct
, ObjectAtk objectAtk
)
306 bool consumed
= false;
308 foreach ( void delegate(ObjectAtk
) dlg
; objectAtk
.onVisibleDataChangedListeners
)
320 * Registers the role specified by name.
322 * a character string describing the new role.
324 * an AtkRole for the new role.
326 public static AtkRole
atkRoleRegister(char[] name
)
328 // AtkRole atk_role_register (const gchar *name);
329 return atk_role_register(Str
.toStringz(name
));
338 * Gets a reference to an object's AtkObject implementation, if
339 * the object implements AtkObjectIface
341 * The GObject instance which should implement AtkImplementorIface
342 * if a non-null return value is required.
344 * a reference to an object's AtkObject implementation
346 public static AtkObject
* atkImplementorRefAccessible(AtkImplementor
* implementor
)
348 // AtkObject* atk_implementor_ref_accessible (AtkImplementor *implementor);
349 return atk_implementor_ref_accessible(implementor
);
353 * Gets the accessible name of the accessible.
357 * a character string representing the accessible name of the object.
359 public char[] getName()
361 // const gchar* atk_object_get_name (AtkObject *accessible);
362 return Str
.toString(atk_object_get_name(atkObject
) );
366 * Gets the accessible description of the accessible.
370 * a character string representing the accessible description
373 public char[] getDescription()
375 // const gchar* atk_object_get_description (AtkObject *accessible);
376 return Str
.toString(atk_object_get_description(atkObject
) );
380 * Gets the accessible parent of the accessible.
384 * a AtkObject representing the accessible parent of the accessible
386 public AtkObject
* getParent()
388 // AtkObject* atk_object_get_parent (AtkObject *accessible);
389 return atk_object_get_parent(atkObject
);
393 * Gets the number of accessible children of the accessible.
397 * an integer representing the number of accessible children
400 public int getNAccessibleChildren()
402 // gint atk_object_get_n_accessible_children (AtkObject *accessible);
403 return atk_object_get_n_accessible_children(atkObject
);
407 * Gets a reference to the specified accessible child of the object.
408 * The accessible children are 0-based so the first accessible child is
409 * at index 0, the second at index 1 and so on.
413 * a gint representing the position of the child, starting from 0
415 * an AtkObject representing the specified accessible child
418 public AtkObject
* refAccessibleChild(int i
)
420 // AtkObject* atk_object_ref_accessible_child (AtkObject *accessible, gint i);
421 return atk_object_ref_accessible_child(atkObject
, i
);
425 * Gets the AtkRelationSet associated with the object.
429 * an AtkRelationSet representing the relation set of the object.
431 public AtkRelationSet
* refRelationSet()
433 // AtkRelationSet* atk_object_ref_relation_set (AtkObject *accessible);
434 return atk_object_ref_relation_set(atkObject
);
439 * atk_object_get_layer is deprecated and should not be used in newly-written code. Use atk_component_get_layer instead.
440 * Gets the layer of the accessible.
445 * an AtkLayer which is the layer of the accessible
447 public AtkLayer
getLayer()
449 // AtkLayer atk_object_get_layer (AtkObject *accessible);
450 return atk_object_get_layer(atkObject
);
455 * atk_object_get_mdi_zorder is deprecated and should not be used in newly-written code. Use atk_component_get_mdi_zorder instead.
456 * Gets the zorder of the accessible. The value G_MININT will be returned
457 * if the layer of the accessible is not ATK_LAYER_MDI.
462 * a gint which is the zorder of the accessible, i.e. the depth at
463 * which the component is shown in relation to other components in the same
466 public int getMdiZorder()
468 // gint atk_object_get_mdi_zorder (AtkObject *accessible);
469 return atk_object_get_mdi_zorder(atkObject
);
473 * Gets the role of the accessible.
477 * an AtkRole which is the role of the accessible
479 public AtkRole
getRole()
481 // AtkRole atk_object_get_role (AtkObject *accessible);
482 return atk_object_get_role(atkObject
);
486 * Gets a reference to the state set of the accessible; the caller must
487 * unreference it when it is no longer needed.
491 * a reference to an AtkStateSet which is the state
492 * set of the accessible
494 public StateSet
refStateSet()
496 // AtkStateSet* atk_object_ref_state_set (AtkObject *accessible);
497 return new StateSet( atk_object_ref_state_set(atkObject
) );
501 * Gets the 0-based index of this accessible in its parent; returns -1 if the
502 * accessible does not have an accessible parent.
506 * an integer which is the index of the accessible in its parent
508 public int getIndexInParent()
510 // gint atk_object_get_index_in_parent (AtkObject *accessible);
511 return atk_object_get_index_in_parent(atkObject
);
515 * Sets the accessible name of the accessible.
519 * a character string to be set as the accessible name
521 public void setName(char[] name
)
523 // void atk_object_set_name (AtkObject *accessible, const gchar *name);
524 atk_object_set_name(atkObject
, Str
.toStringz(name
));
528 * Sets the accessible description of the accessible.
532 * a character string to be set as the accessible description
534 public void setDescription(char[] description
)
536 // void atk_object_set_description (AtkObject *accessible, const gchar *description);
537 atk_object_set_description(atkObject
, Str
.toStringz(description
));
541 * Sets the accessible parent of the accessible.
545 * an AtkObject to be set as the accessible parent
547 public void setParent(AtkObject
* parent
)
549 // void atk_object_set_parent (AtkObject *accessible, AtkObject *parent);
550 atk_object_set_parent(atkObject
, parent
);
554 * Sets the role of the accessible.
558 * an AtkRole to be set as the role
560 public void setRole(AtkRole role
)
562 // void atk_object_set_role (AtkObject *accessible, AtkRole role);
563 atk_object_set_role(atkObject
, role
);
567 * Specifies a function to be called when a property changes value.
571 * a function to be called when a property changes its value
573 * a guint which is the handler id used in
574 * atk_object_remove_property_change_handler()
576 public uint connectPropertyChangeHandler(AtkPropertyChangeHandler
* handler
)
578 // guint atk_object_connect_property_change_handler (AtkObject *accessible, AtkPropertyChangeHandler *handler);
579 return atk_object_connect_property_change_handler(atkObject
, handler
);
583 * Removes a property change handler.
587 * a guint which identifies the handler to be removed.
589 public void removePropertyChangeHandler(uint handlerId
)
591 // void atk_object_remove_property_change_handler (AtkObject *accessible, guint handler_id);
592 atk_object_remove_property_change_handler(atkObject
, handlerId
);
596 * Emits a state-change signal for the specified state.
600 * an AtkState whose state is changed
602 * a gboolean which indicates whether the state is being set on or off
604 public void notifyStateChange(AtkState state
, int value
)
606 // void atk_object_notify_state_change (AtkObject *accessible, AtkState state, gboolean value);
607 atk_object_notify_state_change(atkObject
, state
, value
);
611 * This function is called when implementing subclasses of AtkObject.
612 * It does initialization required for the new object. It is intended
613 * that this function should called only in the ..._new() functions used
614 * to create an instance of a subclass of AtkObject
618 * a gpointer which identifies the object for which the AtkObject was created.
620 public void initialize(void* data
)
622 // void atk_object_initialize (AtkObject *accessible, gpointer data);
623 atk_object_initialize(atkObject
, data
);
627 * Adds a relationship of the specified type with the specified target.
629 * The AtkObject to which an AtkRelation is to be added.
631 * The AtkRelationType of the relation
633 * The AtkObject which is to be the target of the relation.
635 * TRUE if the relationship is added.
637 public int addRelationship(AtkRelationType relationship
, AtkObject
* target
)
639 // gboolean atk_object_add_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target);
640 return atk_object_add_relationship(atkObject
, relationship
, target
);
644 * Removes a relationship of the specified type with the specified target.
646 * The AtkObject from which an AtkRelation is to be removed.
648 * The AtkRelationType of the relation
650 * The AtkObject which is the target of the relation to be removed.
652 * TRUE if the relationship is removed.
654 public int removeRelationship(AtkRelationType relationship
, AtkObject
* target
)
656 // gboolean atk_object_remove_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target);
657 return atk_object_remove_relationship(atkObject
, relationship
, target
);
661 * Get a list of properties applied to this object as a whole, as an AtkAttributeSet consisting of
662 * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations,
663 * as distinct from strongly-typed object data available via other get/set methods.
664 * Not all objects have explicit "name-value pair" AtkAttributeSet properties.
669 * an AtkAttributeSet consisting of all explicit properties/annotations applied to
670 * the object, or an empty set if the object has no name-value pair attributes assigned to it.
673 public AtkAttributeSet
* getAttributes()
675 // AtkAttributeSet* atk_object_get_attributes (AtkObject *accessible);
676 return atk_object_get_attributes(atkObject
);
680 * Gets the description string describing the AtkRole role.
682 * The AtkRole whose name is required
684 * the string describing the AtkRole
686 public static char[] atkRoleGetName(AtkRole role
)
688 // const gchar* atk_role_get_name (AtkRole role);
689 return Str
.toString(atk_role_get_name(role
) );
693 * Gets the localized description string describing the AtkRole role.
695 * The AtkRole whose localized name is required
697 * the localized string describing the AtkRole
699 public static char[] atkRoleGetLocalizedName(AtkRole role
)
701 // const gchar* atk_role_get_localized_name (AtkRole role);
702 return Str
.toString(atk_role_get_localized_name(role
) );
706 * Get the AtkRole type corresponding to a rolew name.
708 * a string which is the (non-localized) name of an ATK role.
710 * the AtkRole enumerated type corresponding to the specified
712 * or ATK_ROLE_INVALID if no matching role is found.
714 * The "accessible-component-layer" property
715 * "accessible-component-layer" gint : Read
716 * The accessible layer of this object.
717 * Allowed values: >= 0
720 public static AtkRole
atkRoleForName(char[] name
)
722 // AtkRole atk_role_for_name (const gchar *name);
723 return atk_role_for_name(Str
.toStringz(name
));