alternative to assert
[gtkD.git] / src / atk / ObjectAtk.d
blobafbe319eed4ee310e0b4ff862e7e20faab9713cc
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
51 module atk.ObjectAtk;
53 private import atk.atktypes;
55 private import lib.atk;
57 private import glib.Str;
58 private import atk.StateSet;
60 /**
61 * Description
62 * This class is the primary class for accessibility support via
63 * the Accessibility ToolKit (ATK). Objects which are instances
64 * of AtkObject (or instances of AtkObject-derived types) are
65 * queried for properties which relate basic (and generic) properties of a
66 * UI component such as name and description. Instances of AtkObject
67 * may also be queried as to whether they implement other ATK interfaces
68 * (e.g. AtkAction, AtkComponent, etc.), as appropriate to the role
69 * which a given UI component plays in a user interface.
70 * All UI components in an application which provide useful
71 * information or services to the user must provide corresponding
72 * AtkObject instances on request (in GTK+, for instance, usually
73 * on a call to #gtk_widget_get_accessible()), either via ATK support
74 * built into the toolkit for the widget class or ancestor class, or in
75 * the case of custom widgets, if the inherited AtkObject implementation
76 * is insufficient, via instances of a new AtkObject subclass.
78 private import gobject.ObjectG;
79 public class ObjectAtk : ObjectG
82 /** the main Gtk struct */
83 protected AtkObject* atkObject;
86 public AtkObject* getObjectAtkStruct()
88 return atkObject;
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)atkObject;
98 /**
99 * Sets our main struct and passes it to the parent class
101 public this (AtkObject* atkObject)
103 super(cast(GObject*)atkObject);
104 this.atkObject = atkObject;
110 // imports for the signal processing
111 private import gobject.Signals;
112 private import gdk.gdktypes;
113 int[char[]] connectedSignals;
115 void delegate(gpointer, ObjectAtk)[] onActiveDescendantChangedListeners;
116 void addOnActiveDescendantChanged(void delegate(gpointer, ObjectAtk) dlg)
118 if ( !("active-descendant-changed" in connectedSignals) )
120 Signals.connectData(
121 getStruct(),
122 "active-descendant-changed",
123 cast(GCallback)&callBackActiveDescendantChanged,
124 this,
125 null,
126 cast(ConnectFlags)0);
127 connectedSignals["active-descendant-changed"] = 1;
129 onActiveDescendantChangedListeners ~= dlg;
131 extern(C) static void callBackActiveDescendantChanged(AtkObject* atkobjectStruct, gpointer arg1, ObjectAtk objectAtk)
133 bit consumed = false;
135 foreach ( void delegate(gpointer, ObjectAtk) dlg ; objectAtk.onActiveDescendantChangedListeners )
137 dlg(arg1, objectAtk);
140 return consumed;
143 void delegate(guint, gpointer, ObjectAtk)[] onChildrenChangedListeners;
144 void addOnChildrenChanged(void delegate(guint, gpointer, ObjectAtk) dlg)
146 if ( !("children-changed" in connectedSignals) )
148 Signals.connectData(
149 getStruct(),
150 "children-changed",
151 cast(GCallback)&callBackChildrenChanged,
152 this,
153 null,
154 cast(ConnectFlags)0);
155 connectedSignals["children-changed"] = 1;
157 onChildrenChangedListeners ~= dlg;
159 extern(C) static void callBackChildrenChanged(AtkObject* atkobjectStruct, guint arg1, gpointer arg2, ObjectAtk objectAtk)
161 bit consumed = false;
163 foreach ( void delegate(guint, gpointer, ObjectAtk) dlg ; objectAtk.onChildrenChangedListeners )
165 dlg(arg1, arg2, objectAtk);
168 return consumed;
171 void delegate(gboolean, ObjectAtk)[] onFocusListeners;
172 void addOnFocus(void delegate(gboolean, ObjectAtk) dlg)
174 if ( !("focus-event" in connectedSignals) )
176 Signals.connectData(
177 getStruct(),
178 "focus-event",
179 cast(GCallback)&callBackFocus,
180 this,
181 null,
182 cast(ConnectFlags)0);
183 connectedSignals["focus-event"] = 1;
185 onFocusListeners ~= dlg;
187 extern(C) static void callBackFocus(AtkObject* atkobjectStruct, gboolean arg1, ObjectAtk objectAtk)
189 bit consumed = false;
191 foreach ( void delegate(gboolean, ObjectAtk) dlg ; objectAtk.onFocusListeners )
193 dlg(arg1, objectAtk);
196 return consumed;
199 void delegate(gpointer, ObjectAtk)[] onPropertyChangeListeners;
200 void addOnPropertyChange(void delegate(gpointer, ObjectAtk) dlg)
202 if ( !("property-change" in connectedSignals) )
204 Signals.connectData(
205 getStruct(),
206 "property-change",
207 cast(GCallback)&callBackPropertyChange,
208 this,
209 null,
210 cast(ConnectFlags)0);
211 connectedSignals["property-change"] = 1;
213 onPropertyChangeListeners ~= dlg;
215 extern(C) static void callBackPropertyChange(AtkObject* atkobjectStruct, gpointer arg1, ObjectAtk objectAtk)
217 bit consumed = false;
219 foreach ( void delegate(gpointer, ObjectAtk) dlg ; objectAtk.onPropertyChangeListeners )
221 dlg(arg1, objectAtk);
224 return consumed;
227 void delegate(char[], gboolean, ObjectAtk)[] onStateChangeListeners;
228 void addOnStateChange(void delegate(char[], gboolean, ObjectAtk) dlg)
230 if ( !("state-change" in connectedSignals) )
232 Signals.connectData(
233 getStruct(),
234 "state-change",
235 cast(GCallback)&callBackStateChange,
236 this,
237 null,
238 cast(ConnectFlags)0);
239 connectedSignals["state-change"] = 1;
241 onStateChangeListeners ~= dlg;
243 extern(C) static void callBackStateChange(AtkObject* atkobjectStruct, gchar* arg1, gboolean arg2, ObjectAtk objectAtk)
245 bit consumed = false;
247 foreach ( void delegate(char[], gboolean, ObjectAtk) dlg ; objectAtk.onStateChangeListeners )
249 dlg(Str.toString(arg1), arg2, objectAtk);
252 return consumed;
255 void delegate(ObjectAtk)[] onVisibleDataChangedListeners;
256 void addOnVisibleDataChanged(void delegate(ObjectAtk) dlg)
258 if ( !("visible-data-changed" in connectedSignals) )
260 Signals.connectData(
261 getStruct(),
262 "visible-data-changed",
263 cast(GCallback)&callBackVisibleDataChanged,
264 this,
265 null,
266 cast(ConnectFlags)0);
267 connectedSignals["visible-data-changed"] = 1;
269 onVisibleDataChangedListeners ~= dlg;
271 extern(C) static void callBackVisibleDataChanged(AtkObject* atkobjectStruct, ObjectAtk objectAtk)
273 bit consumed = false;
275 foreach ( void delegate(ObjectAtk) dlg ; objectAtk.onVisibleDataChangedListeners )
277 dlg(objectAtk);
280 return consumed;
287 * Registers the role specified by name.
288 * name:
289 * a character string describing the new role.
290 * Returns:
291 * an AtkRole for the new role.
293 public static AtkRole atkRoleRegister(char[] name)
295 // AtkRole atk_role_register (const gchar *name);
296 return atk_role_register(Str.toStringz(name));
305 * Gets a reference to an object's AtkObject implementation, if
306 * the object implements AtkObjectIface
307 * implementor:
308 * The GObject instance which should implement AtkImplementorIface
309 * if a non-null return value is required.
310 * Returns:
311 * a reference to an object's AtkObject implementation
313 public static AtkObject* atkImplementorRefAccessible(AtkImplementor* implementor)
315 // AtkObject* atk_implementor_ref_accessible (AtkImplementor *implementor);
316 return atk_implementor_ref_accessible(implementor);
320 * Gets the accessible name of the accessible.
321 * accessible:
322 * an AtkObject
323 * Returns:
324 * a character string representing the accessible name of the object.
326 public char[] getName()
328 // const gchar* atk_object_get_name (AtkObject *accessible);
329 return Str.toString(atk_object_get_name(atkObject) );
333 * Gets the accessible description of the accessible.
334 * accessible:
335 * an AtkObject
336 * Returns:
337 * a character string representing the accessible description
338 * of the accessible.
340 public char[] getDescription()
342 // const gchar* atk_object_get_description (AtkObject *accessible);
343 return Str.toString(atk_object_get_description(atkObject) );
347 * Gets the accessible parent of the accessible.
348 * accessible:
349 * an AtkObject
350 * Returns:
351 * a AtkObject representing the accessible parent of the accessible
353 public AtkObject* getParent()
355 // AtkObject* atk_object_get_parent (AtkObject *accessible);
356 return atk_object_get_parent(atkObject);
360 * Gets the number of accessible children of the accessible.
361 * accessible:
362 * an AtkObject
363 * Returns:
364 * an integer representing the number of accessible children
365 * of the accessible.
367 public int getNAccessibleChildren()
369 // gint atk_object_get_n_accessible_children (AtkObject *accessible);
370 return atk_object_get_n_accessible_children(atkObject);
374 * Gets a reference to the specified accessible child of the object.
375 * The accessible children are 0-based so the first accessible child is
376 * at index 0, the second at index 1 and so on.
377 * accessible:
378 * an AtkObject
379 * i:
380 * a gint representing the position of the child, starting from 0
381 * Returns:
382 * an AtkObject representing the specified accessible child
383 * of the accessible.
385 public AtkObject* refAccessibleChild(int i)
387 // AtkObject* atk_object_ref_accessible_child (AtkObject *accessible, gint i);
388 return atk_object_ref_accessible_child(atkObject, i);
392 * Gets the AtkRelationSet associated with the object.
393 * accessible:
394 * an AtkObject
395 * Returns:
396 * an AtkRelationSet representing the relation set of the object.
398 public AtkRelationSet* refRelationSet()
400 // AtkRelationSet* atk_object_ref_relation_set (AtkObject *accessible);
401 return atk_object_ref_relation_set(atkObject);
405 * Warning
406 * atk_object_get_layer is deprecated and should not be used in newly-written code. Use atk_component_get_layer instead.
407 * Gets the layer of the accessible.
408 * Returns:
409 * accessible:
410 * an AtkObject
411 * Returns:
412 * an AtkLayer which is the layer of the accessible
414 public AtkLayer getLayer()
416 // AtkLayer atk_object_get_layer (AtkObject *accessible);
417 return atk_object_get_layer(atkObject);
421 * Warning
422 * atk_object_get_mdi_zorder is deprecated and should not be used in newly-written code. Use atk_component_get_mdi_zorder instead.
423 * Gets the zorder of the accessible. The value G_MININT will be returned
424 * if the layer of the accessible is not ATK_LAYER_MDI.
425 * Returns:
426 * accessible:
427 * an AtkObject
428 * Returns:
429 * a gint which is the zorder of the accessible, i.e. the depth at
430 * which the component is shown in relation to other components in the same
431 * container.
433 public int getMdiZorder()
435 // gint atk_object_get_mdi_zorder (AtkObject *accessible);
436 return atk_object_get_mdi_zorder(atkObject);
440 * Gets the role of the accessible.
441 * accessible:
442 * an AtkObject
443 * Returns:
444 * an AtkRole which is the role of the accessible
446 public AtkRole getRole()
448 // AtkRole atk_object_get_role (AtkObject *accessible);
449 return atk_object_get_role(atkObject);
453 * Gets a reference to the state set of the accessible; the caller must
454 * unreference it when it is no longer needed.
455 * accessible:
456 * an AtkObject
457 * Returns:
458 * a reference to an AtkStateSet which is the state
459 * set of the accessible
461 public StateSet refStateSet()
463 // AtkStateSet* atk_object_ref_state_set (AtkObject *accessible);
464 return new StateSet( atk_object_ref_state_set(atkObject) );
468 * Gets the 0-based index of this accessible in its parent; returns -1 if the
469 * accessible does not have an accessible parent.
470 * accessible:
471 * an AtkObject
472 * Returns:
473 * an integer which is the index of the accessible in its parent
475 public int getIndexInParent()
477 // gint atk_object_get_index_in_parent (AtkObject *accessible);
478 return atk_object_get_index_in_parent(atkObject);
482 * Sets the accessible name of the accessible.
483 * accessible:
484 * an AtkObject
485 * name:
486 * a character string to be set as the accessible name
488 public void setName(char[] name)
490 // void atk_object_set_name (AtkObject *accessible, const gchar *name);
491 atk_object_set_name(atkObject, Str.toStringz(name));
495 * Sets the accessible description of the accessible.
496 * accessible:
497 * an AtkObject
498 * description:
499 * a character string to be set as the accessible description
501 public void setDescription(char[] description)
503 // void atk_object_set_description (AtkObject *accessible, const gchar *description);
504 atk_object_set_description(atkObject, Str.toStringz(description));
508 * Sets the accessible parent of the accessible.
509 * accessible:
510 * an AtkObject
511 * parent:
512 * an AtkObject to be set as the accessible parent
514 public void setParent(AtkObject* parent)
516 // void atk_object_set_parent (AtkObject *accessible, AtkObject *parent);
517 atk_object_set_parent(atkObject, parent);
521 * Sets the role of the accessible.
522 * accessible:
523 * an AtkObject
524 * role:
525 * an AtkRole to be set as the role
527 public void setRole(AtkRole role)
529 // void atk_object_set_role (AtkObject *accessible, AtkRole role);
530 atk_object_set_role(atkObject, role);
534 * Specifies a function to be called when a property changes value.
535 * accessible:
536 * an AtkObject
537 * handler:
538 * a function to be called when a property changes its value
539 * Returns:
540 * a guint which is the handler id used in
541 * atk_object_remove_property_change_handler()
543 public uint connectPropertyChangeHandler(AtkPropertyChangeHandler* handler)
545 // guint atk_object_connect_property_change_handler (AtkObject *accessible, AtkPropertyChangeHandler *handler);
546 return atk_object_connect_property_change_handler(atkObject, handler);
550 * Removes a property change handler.
551 * accessible:
552 * an AtkObject
553 * handler_id:
554 * a guint which identifies the handler to be removed.
556 public void removePropertyChangeHandler(uint handlerId)
558 // void atk_object_remove_property_change_handler (AtkObject *accessible, guint handler_id);
559 atk_object_remove_property_change_handler(atkObject, handlerId);
563 * Emits a state-change signal for the specified state.
564 * accessible:
565 * an AtkObject
566 * state:
567 * an AtkState whose state is changed
568 * value:
569 * a gboolean which indicates whether the state is being set on or off
571 public void notifyStateChange(AtkState state, int value)
573 // void atk_object_notify_state_change (AtkObject *accessible, AtkState state, gboolean value);
574 atk_object_notify_state_change(atkObject, state, value);
578 * This function is called when implementing subclasses of AtkObject.
579 * It does initialization required for the new object. It is intended
580 * that this function should called only in the ..._new() functions used
581 * to create an instance of a subclass of AtkObject
582 * accessible:
583 * a AtkObject
584 * data:
585 * a gpointer which identifies the object for which the AtkObject was created.
587 public void initialize(void* data)
589 // void atk_object_initialize (AtkObject *accessible, gpointer data);
590 atk_object_initialize(atkObject, data);
594 * Adds a relationship of the specified type with the specified target.
595 * object:
596 * The AtkObject to which an AtkRelation is to be added.
597 * relationship:
598 * The AtkRelationType of the relation
599 * target:
600 * The AtkObject which is to be the target of the relation.
601 * Returns:
602 * TRUE if the relationship is added.
604 public int addRelationship(AtkRelationType relationship, AtkObject* target)
606 // gboolean atk_object_add_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target);
607 return atk_object_add_relationship(atkObject, relationship, target);
611 * Removes a relationship of the specified type with the specified target.
612 * object:
613 * The AtkObject from which an AtkRelation is to be removed.
614 * relationship:
615 * The AtkRelationType of the relation
616 * target:
617 * The AtkObject which is the target of the relation to be removed.
618 * Returns:
619 * TRUE if the relationship is removed.
621 public int removeRelationship(AtkRelationType relationship, AtkObject* target)
623 // gboolean atk_object_remove_relationship (AtkObject *object, AtkRelationType relationship, AtkObject *target);
624 return atk_object_remove_relationship(atkObject, relationship, target);
628 * Get a list of properties applied to this object as a whole, as an AtkAttributeSet consisting of
629 * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations,
630 * as distinct from strongly-typed object data available via other get/set methods.
631 * Not all objects have explicit "name-value pair" AtkAttributeSet properties.
632 * Returns:
633 * accessible:
634 * An AtkObject.
635 * Returns:
636 * an AtkAttributeSet consisting of all explicit properties/annotations applied to
637 * the object, or an empty set if the object has no name-value pair attributes assigned to it.
638 * Since ATK 1.12
640 public AtkAttributeSet* getAttributes()
642 // AtkAttributeSet* atk_object_get_attributes (AtkObject *accessible);
643 return atk_object_get_attributes(atkObject);
647 * Gets the description string describing the AtkRole role.
648 * role:
649 * The AtkRole whose name is required
650 * Returns:
651 * the string describing the AtkRole
653 public static char[] atkRoleGetName(AtkRole role)
655 // const gchar* atk_role_get_name (AtkRole role);
656 return Str.toString(atk_role_get_name(role) );
660 * Gets the localized description string describing the AtkRole role.
661 * role:
662 * The AtkRole whose localized name is required
663 * Returns:
664 * the localized string describing the AtkRole
666 public static char[] atkRoleGetLocalizedName(AtkRole role)
668 // const gchar* atk_role_get_localized_name (AtkRole role);
669 return Str.toString(atk_role_get_localized_name(role) );
673 * Get the AtkRole type corresponding to a rolew name.
674 * name:
675 * a string which is the (non-localized) name of an ATK role.
676 * Returns:
677 * the AtkRole enumerated type corresponding to the specified
678 * name,
679 * or ATK_ROLE_INVALID if no matching role is found.
680 * Property Details
681 * The "accessible-component-layer" property
682 * "accessible-component-layer" gint : Read
683 * The accessible layer of this object.
684 * Allowed values: >= 0
685 * Default value: 0
687 public static AtkRole atkRoleForName(char[] name)
689 // AtkRole atk_role_for_name (const gchar *name);
690 return atk_role_for_name(Str.toStringz(name));