Wrote the README_GIT file to be a proper tutorial on git, repo.or.cz and gtkD.
[gtkD.git] / gtkD / src / atk / ObjectAtk.d
blobdcdb829ff293b97a8c7658c625e8d403a0a52280
1 /*
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
26 * outPack = atk
27 * outFile = ObjectAtk
28 * strct = AtkObject
29 * realStrct=
30 * ctorStrct=
31 * clss = ObjectAtk
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - atk_object_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * - atk.StateSet
46 * structWrap:
47 * - AtkStateSet* -> StateSet
48 * module aliases:
49 * local aliases:
52 module atk.ObjectAtk;
54 version(noAssert)
56 version(Tango)
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;
73 /**
74 * Description
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()
101 return atkObject;
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)
116 version(noAssert)
118 if ( atkObject is null )
120 int zero = 0;
121 version(Tango)
123 Stdout("struct atkObject is null on constructor").newline;
125 else
127 printf("struct atkObject is null on constructor");
129 zero = zero / zero;
132 else
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) )
153 Signals.connectData(
154 getStruct(),
155 "active-descendant-changed",
156 cast(GCallback)&callBackActiveDescendantChanged,
157 cast(void*)this,
158 null,
159 connectFlags);
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);
173 return consumed;
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) )
181 Signals.connectData(
182 getStruct(),
183 "children-changed",
184 cast(GCallback)&callBackChildrenChanged,
185 cast(void*)this,
186 null,
187 connectFlags);
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);
201 return consumed;
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) )
209 Signals.connectData(
210 getStruct(),
211 "focus-event",
212 cast(GCallback)&callBackFocus,
213 cast(void*)this,
214 null,
215 connectFlags);
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);
229 return consumed;
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) )
237 Signals.connectData(
238 getStruct(),
239 "property-change",
240 cast(GCallback)&callBackPropertyChange,
241 cast(void*)this,
242 null,
243 connectFlags);
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);
257 return consumed;
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) )
265 Signals.connectData(
266 getStruct(),
267 "state-change",
268 cast(GCallback)&callBackStateChange,
269 cast(void*)this,
270 null,
271 connectFlags);
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);
285 return consumed;
288 void delegate(ObjectAtk)[] onVisibleDataChangedListeners;
289 void addOnVisibleDataChanged(void delegate(ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
291 if ( !("visible-data-changed" in connectedSignals) )
293 Signals.connectData(
294 getStruct(),
295 "visible-data-changed",
296 cast(GCallback)&callBackVisibleDataChanged,
297 cast(void*)this,
298 null,
299 connectFlags);
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 )
310 dlg(objectAtk);
313 return consumed;
320 * Registers the role specified by name.
321 * name:
322 * a character string describing the new role.
323 * Returns:
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
340 * implementor:
341 * The GObject instance which should implement AtkImplementorIface
342 * if a non-null return value is required.
343 * Returns:
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.
354 * accessible:
355 * an AtkObject
356 * Returns:
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.
367 * accessible:
368 * an AtkObject
369 * Returns:
370 * a character string representing the accessible description
371 * of the accessible.
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.
381 * accessible:
382 * an AtkObject
383 * Returns:
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.
394 * accessible:
395 * an AtkObject
396 * Returns:
397 * an integer representing the number of accessible children
398 * of the accessible.
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.
410 * accessible:
411 * an AtkObject
412 * i:
413 * a gint representing the position of the child, starting from 0
414 * Returns:
415 * an AtkObject representing the specified accessible child
416 * of the accessible.
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.
426 * accessible:
427 * an AtkObject
428 * Returns:
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);
438 * Warning
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.
441 * Returns:
442 * accessible:
443 * an AtkObject
444 * Returns:
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);
454 * Warning
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.
458 * Returns:
459 * accessible:
460 * an AtkObject
461 * Returns:
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
464 * container.
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.
474 * accessible:
475 * an AtkObject
476 * Returns:
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.
488 * accessible:
489 * an AtkObject
490 * Returns:
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.
503 * accessible:
504 * an AtkObject
505 * Returns:
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.
516 * accessible:
517 * an AtkObject
518 * name:
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.
529 * accessible:
530 * an AtkObject
531 * description:
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.
542 * accessible:
543 * an AtkObject
544 * parent:
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.
555 * accessible:
556 * an AtkObject
557 * role:
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.
568 * accessible:
569 * an AtkObject
570 * handler:
571 * a function to be called when a property changes its value
572 * Returns:
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.
584 * accessible:
585 * an AtkObject
586 * handler_id:
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.
597 * accessible:
598 * an AtkObject
599 * state:
600 * an AtkState whose state is changed
601 * value:
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
615 * accessible:
616 * a AtkObject
617 * data:
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.
628 * object:
629 * The AtkObject to which an AtkRelation is to be added.
630 * relationship:
631 * The AtkRelationType of the relation
632 * target:
633 * The AtkObject which is to be the target of the relation.
634 * Returns:
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.
645 * object:
646 * The AtkObject from which an AtkRelation is to be removed.
647 * relationship:
648 * The AtkRelationType of the relation
649 * target:
650 * The AtkObject which is the target of the relation to be removed.
651 * Returns:
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.
665 * Returns:
666 * accessible:
667 * An AtkObject.
668 * Returns:
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.
671 * Since ATK 1.12
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.
681 * role:
682 * The AtkRole whose name is required
683 * Returns:
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.
694 * role:
695 * The AtkRole whose localized name is required
696 * Returns:
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.
707 * name:
708 * a string which is the (non-localized) name of an ATK role.
709 * Returns:
710 * the AtkRole enumerated type corresponding to the specified
711 * name,
712 * or ATK_ROLE_INVALID if no matching role is found.
713 * Property Details
714 * The "accessible-component-layer" property
715 * "accessible-component-layer" gint : Read
716 * The accessible layer of this object.
717 * Allowed values: >= 0
718 * Default value: 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));