1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module atk.ObjectAtk;
26 
27 private import atk.RelationSet;
28 private import atk.StateSet;
29 private import atk.c.functions;
30 public  import atk.c.types;
31 private import glib.Str;
32 private import gobject.ObjectG;
33 private import gobject.Signals;
34 public  import gtkc.atktypes;
35 private import std.algorithm;
36 
37 
38 /**
39  * This class is the primary class for accessibility support via the
40  * Accessibility ToolKit (ATK).  Objects which are instances of
41  * #AtkObject (or instances of AtkObject-derived types) are queried
42  * for properties which relate basic (and generic) properties of a UI
43  * component such as name and description.  Instances of #AtkObject
44  * may also be queried as to whether they implement other ATK
45  * interfaces (e.g. #AtkAction, #AtkComponent, etc.), as appropriate
46  * to the role which a given UI component plays in a user interface.
47  * 
48  * All UI components in an application which provide useful
49  * information or services to the user must provide corresponding
50  * #AtkObject instances on request (in GTK+, for instance, usually on
51  * a call to #gtk_widget_get_accessible ()), either via ATK support
52  * built into the toolkit for the widget class or ancestor class, or
53  * in the case of custom widgets, if the inherited #AtkObject
54  * implementation is insufficient, via instances of a new #AtkObject
55  * subclass.
56  * 
57  * See also: #AtkObjectFactory, #AtkRegistry.  (GTK+ users see also
58  * #GtkAccessible).
59  */
60 public class ObjectAtk : ObjectG
61 {
62 	/** the main Gtk struct */
63 	protected AtkObject* atkObject;
64 
65 	/** Get the main Gtk struct */
66 	public AtkObject* getObjectAtkStruct(bool transferOwnership = false)
67 	{
68 		if (transferOwnership)
69 			ownedRef = false;
70 		return atkObject;
71 	}
72 
73 	/** the main Gtk struct as a void* */
74 	protected override void* getStruct()
75 	{
76 		return cast(void*)atkObject;
77 	}
78 
79 	protected override void setStruct(GObject* obj)
80 	{
81 		atkObject = cast(AtkObject*)obj;
82 		super.setStruct(obj);
83 	}
84 
85 	/**
86 	 * Sets our main struct and passes it to the parent class.
87 	 */
88 	public this (AtkObject* atkObject, bool ownedRef = false)
89 	{
90 		this.atkObject = atkObject;
91 		super(cast(GObject*)atkObject, ownedRef);
92 	}
93 
94 
95 	/** */
96 	public static GType getType()
97 	{
98 		return atk_object_get_type();
99 	}
100 
101 	/**
102 	 * Adds a relationship of the specified type with the specified target.
103 	 *
104 	 * Params:
105 	 *     relationship = The #AtkRelationType of the relation
106 	 *     target = The #AtkObject which is to be the target of the relation.
107 	 *
108 	 * Returns: TRUE if the relationship is added.
109 	 */
110 	public bool addRelationship(AtkRelationType relationship, ObjectAtk target)
111 	{
112 		return atk_object_add_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()) != 0;
113 	}
114 
115 	/**
116 	 *
117 	 *
118 	 * Deprecated: Since 2.12. Connect directly to property-change or
119 	 * notify signals.
120 	 *
121 	 * Params:
122 	 *     handler = a function to be called when a property changes its value
123 	 *
124 	 * Returns: a #guint which is the handler id used in
125 	 *     atk_object_remove_property_change_handler()
126 	 */
127 	public uint connectPropertyChangeHandler(AtkPropertyChangeHandler* handler)
128 	{
129 		return atk_object_connect_property_change_handler(atkObject, handler);
130 	}
131 
132 	/**
133 	 * Get a list of properties applied to this object as a whole, as an #AtkAttributeSet consisting of
134 	 * name-value pairs. As such these attributes may be considered weakly-typed properties or annotations,
135 	 * as distinct from strongly-typed object data available via other get/set methods.
136 	 * Not all objects have explicit "name-value pair" #AtkAttributeSet properties.
137 	 *
138 	 * Returns: an #AtkAttributeSet consisting of all
139 	 *     explicit properties/annotations applied to the object, or an empty
140 	 *     set if the object has no name-value pair attributes assigned to
141 	 *     it. This #atkattributeset should be freed by a call to
142 	 *     atk_attribute_set_free().
143 	 *
144 	 * Since: 1.12
145 	 */
146 	public AtkAttributeSet* getAttributes()
147 	{
148 		return atk_object_get_attributes(atkObject);
149 	}
150 
151 	/**
152 	 * Gets the accessible description of the accessible.
153 	 *
154 	 * Returns: a character string representing the accessible description
155 	 *     of the accessible.
156 	 */
157 	public string getDescription()
158 	{
159 		return Str.toString(atk_object_get_description(atkObject));
160 	}
161 
162 	/**
163 	 * Gets the 0-based index of this accessible in its parent; returns -1 if the
164 	 * accessible does not have an accessible parent.
165 	 *
166 	 * Returns: an integer which is the index of the accessible in its parent
167 	 */
168 	public int getIndexInParent()
169 	{
170 		return atk_object_get_index_in_parent(atkObject);
171 	}
172 
173 	/**
174 	 * Gets the layer of the accessible.
175 	 *
176 	 * Deprecated: Use atk_component_get_layer instead.
177 	 *
178 	 * Returns: an #AtkLayer which is the layer of the accessible
179 	 */
180 	public AtkLayer getLayer()
181 	{
182 		return atk_object_get_layer(atkObject);
183 	}
184 
185 	/**
186 	 * Gets the zorder of the accessible. The value G_MININT will be returned
187 	 * if the layer of the accessible is not ATK_LAYER_MDI.
188 	 *
189 	 * Deprecated: Use atk_component_get_mdi_zorder instead.
190 	 *
191 	 * Returns: a gint which is the zorder of the accessible, i.e. the depth at
192 	 *     which the component is shown in relation to other components in the same
193 	 *     container.
194 	 */
195 	public int getMdiZorder()
196 	{
197 		return atk_object_get_mdi_zorder(atkObject);
198 	}
199 
200 	/**
201 	 * Gets the number of accessible children of the accessible.
202 	 *
203 	 * Returns: an integer representing the number of accessible children
204 	 *     of the accessible.
205 	 */
206 	public int getNAccessibleChildren()
207 	{
208 		return atk_object_get_n_accessible_children(atkObject);
209 	}
210 
211 	/**
212 	 * Gets the accessible name of the accessible.
213 	 *
214 	 * Returns: a character string representing the accessible name of the object.
215 	 */
216 	public string getName()
217 	{
218 		return Str.toString(atk_object_get_name(atkObject));
219 	}
220 
221 	/**
222 	 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
223 	 * of @accessible.
224 	 *
225 	 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
226 	 *     locale of @accessible.
227 	 *
228 	 * Since: 2.8
229 	 */
230 	public string getObjectLocale()
231 	{
232 		return Str.toString(atk_object_get_object_locale(atkObject));
233 	}
234 
235 	/**
236 	 * Gets the accessible parent of the accessible. By default this is
237 	 * the one assigned with atk_object_set_parent(), but it is assumed
238 	 * that ATK implementors have ways to get the parent of the object
239 	 * without the need of assigning it manually with
240 	 * atk_object_set_parent(), and will return it with this method.
241 	 *
242 	 * If you are only interested on the parent assigned with
243 	 * atk_object_set_parent(), use atk_object_peek_parent().
244 	 *
245 	 * Returns: an #AtkObject representing the accessible
246 	 *     parent of the accessible
247 	 */
248 	public ObjectAtk getParent()
249 	{
250 		auto p = atk_object_get_parent(atkObject);
251 
252 		if(p is null)
253 		{
254 			return null;
255 		}
256 
257 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p);
258 	}
259 
260 	/**
261 	 * Gets the role of the accessible.
262 	 *
263 	 * Returns: an #AtkRole which is the role of the accessible
264 	 */
265 	public AtkRole getRole()
266 	{
267 		return atk_object_get_role(atkObject);
268 	}
269 
270 	/**
271 	 * This function is called when implementing subclasses of #AtkObject.
272 	 * It does initialization required for the new object. It is intended
273 	 * that this function should called only in the ..._new() functions used
274 	 * to create an instance of a subclass of #AtkObject
275 	 *
276 	 * Params:
277 	 *     data = a #gpointer which identifies the object for which the AtkObject was created.
278 	 */
279 	public void initialize(void* data)
280 	{
281 		atk_object_initialize(atkObject, data);
282 	}
283 
284 	/**
285 	 * Emits a state-change signal for the specified state.
286 	 *
287 	 * Note that as a general rule when the state of an existing object changes,
288 	 * emitting a notification is expected.
289 	 *
290 	 * Params:
291 	 *     state = an #AtkState whose state is changed
292 	 *     value = a gboolean which indicates whether the state is being set on or off
293 	 */
294 	public void notifyStateChange(AtkState state, bool value)
295 	{
296 		atk_object_notify_state_change(atkObject, state, value);
297 	}
298 
299 	/**
300 	 * Gets the accessible parent of the accessible, if it has been
301 	 * manually assigned with atk_object_set_parent. Otherwise, this
302 	 * function returns %NULL.
303 	 *
304 	 * This method is intended as an utility for ATK implementors, and not
305 	 * to be exposed to accessible tools. See atk_object_get_parent() for
306 	 * further reference.
307 	 *
308 	 * Returns: an #AtkObject representing the accessible
309 	 *     parent of the accessible if assigned
310 	 */
311 	public ObjectAtk peekParent()
312 	{
313 		auto p = atk_object_peek_parent(atkObject);
314 
315 		if(p is null)
316 		{
317 			return null;
318 		}
319 
320 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p);
321 	}
322 
323 	/**
324 	 * Gets a reference to the specified accessible child of the object.
325 	 * The accessible children are 0-based so the first accessible child is
326 	 * at index 0, the second at index 1 and so on.
327 	 *
328 	 * Params:
329 	 *     i = a gint representing the position of the child, starting from 0
330 	 *
331 	 * Returns: an #AtkObject representing the specified
332 	 *     accessible child of the accessible.
333 	 */
334 	public ObjectAtk refAccessibleChild(int i)
335 	{
336 		auto p = atk_object_ref_accessible_child(atkObject, i);
337 
338 		if(p is null)
339 		{
340 			return null;
341 		}
342 
343 		return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p, true);
344 	}
345 
346 	/**
347 	 * Gets the #AtkRelationSet associated with the object.
348 	 *
349 	 * Returns: an #AtkRelationSet representing the relation set
350 	 *     of the object.
351 	 */
352 	public RelationSet refRelationSet()
353 	{
354 		auto p = atk_object_ref_relation_set(atkObject);
355 
356 		if(p is null)
357 		{
358 			return null;
359 		}
360 
361 		return ObjectG.getDObject!(RelationSet)(cast(AtkRelationSet*) p, true);
362 	}
363 
364 	/**
365 	 * Gets a reference to the state set of the accessible; the caller must
366 	 * unreference it when it is no longer needed.
367 	 *
368 	 * Returns: a reference to an #AtkStateSet which is the state
369 	 *     set of the accessible
370 	 */
371 	public StateSet refStateSet()
372 	{
373 		auto p = atk_object_ref_state_set(atkObject);
374 
375 		if(p is null)
376 		{
377 			return null;
378 		}
379 
380 		return ObjectG.getDObject!(StateSet)(cast(AtkStateSet*) p, true);
381 	}
382 
383 	/**
384 	 *
385 	 *
386 	 * Deprecated: Since 2.12.
387 	 *
388 	 * Removes a property change handler.
389 	 *
390 	 * Params:
391 	 *     handlerId = a guint which identifies the handler to be removed.
392 	 */
393 	public void removePropertyChangeHandler(uint handlerId)
394 	{
395 		atk_object_remove_property_change_handler(atkObject, handlerId);
396 	}
397 
398 	/**
399 	 * Removes a relationship of the specified type with the specified target.
400 	 *
401 	 * Params:
402 	 *     relationship = The #AtkRelationType of the relation
403 	 *     target = The #AtkObject which is the target of the relation to be removed.
404 	 *
405 	 * Returns: TRUE if the relationship is removed.
406 	 */
407 	public bool removeRelationship(AtkRelationType relationship, ObjectAtk target)
408 	{
409 		return atk_object_remove_relationship(atkObject, relationship, (target is null) ? null : target.getObjectAtkStruct()) != 0;
410 	}
411 
412 	/**
413 	 * Sets the accessible description of the accessible. You can't set
414 	 * the description to NULL. This is reserved for the initial value. In
415 	 * this aspect NULL is similar to ATK_ROLE_UNKNOWN. If you want to set
416 	 * the name to a empty value you can use "".
417 	 *
418 	 * Params:
419 	 *     description = a character string to be set as the accessible description
420 	 */
421 	public void setDescription(string description)
422 	{
423 		atk_object_set_description(atkObject, Str.toStringz(description));
424 	}
425 
426 	/**
427 	 * Sets the accessible name of the accessible. You can't set the name
428 	 * to NULL. This is reserved for the initial value. In this aspect
429 	 * NULL is similar to ATK_ROLE_UNKNOWN. If you want to set the name to
430 	 * a empty value you can use "".
431 	 *
432 	 * Params:
433 	 *     name = a character string to be set as the accessible name
434 	 */
435 	public void setName(string name)
436 	{
437 		atk_object_set_name(atkObject, Str.toStringz(name));
438 	}
439 
440 	/**
441 	 * Sets the accessible parent of the accessible. @parent can be NULL.
442 	 *
443 	 * Params:
444 	 *     parent = an #AtkObject to be set as the accessible parent
445 	 */
446 	public void setParent(ObjectAtk parent)
447 	{
448 		atk_object_set_parent(atkObject, (parent is null) ? null : parent.getObjectAtkStruct());
449 	}
450 
451 	/**
452 	 * Sets the role of the accessible.
453 	 *
454 	 * Params:
455 	 *     role = an #AtkRole to be set as the role
456 	 */
457 	public void setRole(AtkRole role)
458 	{
459 		atk_object_set_role(atkObject, role);
460 	}
461 
462 	protected class OnActiveDescendantChangedDelegateWrapper
463 	{
464 		void delegate(void*, ObjectAtk) dlg;
465 		gulong handlerId;
466 
467 		this(void delegate(void*, ObjectAtk) dlg)
468 		{
469 			this.dlg = dlg;
470 			onActiveDescendantChangedListeners ~= this;
471 		}
472 
473 		void remove(OnActiveDescendantChangedDelegateWrapper source)
474 		{
475 			foreach(index, wrapper; onActiveDescendantChangedListeners)
476 			{
477 				if (wrapper.handlerId == source.handlerId)
478 				{
479 					onActiveDescendantChangedListeners[index] = null;
480 					onActiveDescendantChangedListeners = std.algorithm.remove(onActiveDescendantChangedListeners, index);
481 					break;
482 				}
483 			}
484 		}
485 	}
486 	OnActiveDescendantChangedDelegateWrapper[] onActiveDescendantChangedListeners;
487 
488 	/**
489 	 * The "active-descendant-changed" signal is emitted by an object
490 	 * which has the state ATK_STATE_MANAGES_DESCENDANTS when the focus
491 	 * object in the object changes. For instance, a table will emit the
492 	 * signal when the cell in the table which has focus changes.
493 	 *
494 	 * Params:
495 	 *     arg1 = the newly focused object.
496 	 */
497 	gulong addOnActiveDescendantChanged(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
498 	{
499 		auto wrapper = new OnActiveDescendantChangedDelegateWrapper(dlg);
500 		wrapper.handlerId = Signals.connectData(
501 			this,
502 			"active-descendant-changed",
503 			cast(GCallback)&callBackActiveDescendantChanged,
504 			cast(void*)wrapper,
505 			cast(GClosureNotify)&callBackActiveDescendantChangedDestroy,
506 			connectFlags);
507 		return wrapper.handlerId;
508 	}
509 
510 	extern(C) static void callBackActiveDescendantChanged(AtkObject* objectatkStruct, void* arg1, OnActiveDescendantChangedDelegateWrapper wrapper)
511 	{
512 		wrapper.dlg(arg1, wrapper.outer);
513 	}
514 
515 	extern(C) static void callBackActiveDescendantChangedDestroy(OnActiveDescendantChangedDelegateWrapper wrapper, GClosure* closure)
516 	{
517 		wrapper.remove(wrapper);
518 	}
519 
520 	protected class OnChildrenChangedDelegateWrapper
521 	{
522 		void delegate(uint, void*, ObjectAtk) dlg;
523 		gulong handlerId;
524 
525 		this(void delegate(uint, void*, ObjectAtk) dlg)
526 		{
527 			this.dlg = dlg;
528 			onChildrenChangedListeners ~= this;
529 		}
530 
531 		void remove(OnChildrenChangedDelegateWrapper source)
532 		{
533 			foreach(index, wrapper; onChildrenChangedListeners)
534 			{
535 				if (wrapper.handlerId == source.handlerId)
536 				{
537 					onChildrenChangedListeners[index] = null;
538 					onChildrenChangedListeners = std.algorithm.remove(onChildrenChangedListeners, index);
539 					break;
540 				}
541 			}
542 		}
543 	}
544 	OnChildrenChangedDelegateWrapper[] onChildrenChangedListeners;
545 
546 	/**
547 	 * The signal "children-changed" is emitted when a child is added or
548 	 * removed form an object. It supports two details: "add" and
549 	 * "remove"
550 	 *
551 	 * Params:
552 	 *     arg1 = The index of the added or removed child. The value can be
553 	 *         -1. This is used if the value is not known by the implementor
554 	 *         when the child is added/removed or irrelevant.
555 	 *     arg2 = A gpointer to the child AtkObject which was added or
556 	 *         removed. If the child was removed, it is possible that it is not
557 	 *         available for the implementor. In that case this pointer can be
558 	 *         NULL.
559 	 */
560 	gulong addOnChildrenChanged(void delegate(uint, void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
561 	{
562 		auto wrapper = new OnChildrenChangedDelegateWrapper(dlg);
563 		wrapper.handlerId = Signals.connectData(
564 			this,
565 			"children-changed",
566 			cast(GCallback)&callBackChildrenChanged,
567 			cast(void*)wrapper,
568 			cast(GClosureNotify)&callBackChildrenChangedDestroy,
569 			connectFlags);
570 		return wrapper.handlerId;
571 	}
572 
573 	extern(C) static void callBackChildrenChanged(AtkObject* objectatkStruct, uint arg1, void* arg2, OnChildrenChangedDelegateWrapper wrapper)
574 	{
575 		wrapper.dlg(arg1, arg2, wrapper.outer);
576 	}
577 
578 	extern(C) static void callBackChildrenChangedDestroy(OnChildrenChangedDelegateWrapper wrapper, GClosure* closure)
579 	{
580 		wrapper.remove(wrapper);
581 	}
582 
583 	protected class OnFocusDelegateWrapper
584 	{
585 		void delegate(bool, ObjectAtk) dlg;
586 		gulong handlerId;
587 
588 		this(void delegate(bool, ObjectAtk) dlg)
589 		{
590 			this.dlg = dlg;
591 			onFocusListeners ~= this;
592 		}
593 
594 		void remove(OnFocusDelegateWrapper source)
595 		{
596 			foreach(index, wrapper; onFocusListeners)
597 			{
598 				if (wrapper.handlerId == source.handlerId)
599 				{
600 					onFocusListeners[index] = null;
601 					onFocusListeners = std.algorithm.remove(onFocusListeners, index);
602 					break;
603 				}
604 			}
605 		}
606 	}
607 	OnFocusDelegateWrapper[] onFocusListeners;
608 
609 	/**
610 	 * The signal "focus-event" is emitted when an object gained or lost
611 	 * focus.
612 	 *
613 	 * Deprecated: Use the #AtkObject::state-change signal instead.
614 	 *
615 	 * Params:
616 	 *     arg1 = a boolean value which indicates whether the object gained
617 	 *         or lost focus.
618 	 */
619 	gulong addOnFocus(void delegate(bool, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
620 	{
621 		auto wrapper = new OnFocusDelegateWrapper(dlg);
622 		wrapper.handlerId = Signals.connectData(
623 			this,
624 			"focus-event",
625 			cast(GCallback)&callBackFocus,
626 			cast(void*)wrapper,
627 			cast(GClosureNotify)&callBackFocusDestroy,
628 			connectFlags);
629 		return wrapper.handlerId;
630 	}
631 
632 	extern(C) static void callBackFocus(AtkObject* objectatkStruct, bool arg1, OnFocusDelegateWrapper wrapper)
633 	{
634 		wrapper.dlg(arg1, wrapper.outer);
635 	}
636 
637 	extern(C) static void callBackFocusDestroy(OnFocusDelegateWrapper wrapper, GClosure* closure)
638 	{
639 		wrapper.remove(wrapper);
640 	}
641 
642 	protected class OnPropertyChangeDelegateWrapper
643 	{
644 		void delegate(void*, ObjectAtk) dlg;
645 		gulong handlerId;
646 
647 		this(void delegate(void*, ObjectAtk) dlg)
648 		{
649 			this.dlg = dlg;
650 			onPropertyChangeListeners ~= this;
651 		}
652 
653 		void remove(OnPropertyChangeDelegateWrapper source)
654 		{
655 			foreach(index, wrapper; onPropertyChangeListeners)
656 			{
657 				if (wrapper.handlerId == source.handlerId)
658 				{
659 					onPropertyChangeListeners[index] = null;
660 					onPropertyChangeListeners = std.algorithm.remove(onPropertyChangeListeners, index);
661 					break;
662 				}
663 			}
664 		}
665 	}
666 	OnPropertyChangeDelegateWrapper[] onPropertyChangeListeners;
667 
668 	/**
669 	 * The signal "property-change" is emitted when an object's property
670 	 * value changes. @arg1 contains an #AtkPropertyValues with the name
671 	 * and the new value of the property whose value has changed. Note
672 	 * that, as with GObject notify, getting this signal does not
673 	 * guarantee that the value of the property has actually changed; it
674 	 * may also be emitted when the setter of the property is called to
675 	 * reinstate the previous value.
676 	 *
677 	 * Toolkit implementor note: ATK implementors should use
678 	 * g_object_notify() to emit property-changed
679 	 * notifications. #AtkObject::property-changed is needed by the
680 	 * implementation of atk_add_global_event_listener() because GObject
681 	 * notify doesn't support emission hooks.
682 	 *
683 	 * Params:
684 	 *     arg1 = an #AtkPropertyValues containing the new value of the
685 	 *         property which changed.
686 	 */
687 	gulong addOnPropertyChange(void delegate(void*, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
688 	{
689 		auto wrapper = new OnPropertyChangeDelegateWrapper(dlg);
690 		wrapper.handlerId = Signals.connectData(
691 			this,
692 			"property-change",
693 			cast(GCallback)&callBackPropertyChange,
694 			cast(void*)wrapper,
695 			cast(GClosureNotify)&callBackPropertyChangeDestroy,
696 			connectFlags);
697 		return wrapper.handlerId;
698 	}
699 
700 	extern(C) static void callBackPropertyChange(AtkObject* objectatkStruct, void* arg1, OnPropertyChangeDelegateWrapper wrapper)
701 	{
702 		wrapper.dlg(arg1, wrapper.outer);
703 	}
704 
705 	extern(C) static void callBackPropertyChangeDestroy(OnPropertyChangeDelegateWrapper wrapper, GClosure* closure)
706 	{
707 		wrapper.remove(wrapper);
708 	}
709 
710 	protected class OnStateChangeDelegateWrapper
711 	{
712 		void delegate(string, bool, ObjectAtk) dlg;
713 		gulong handlerId;
714 
715 		this(void delegate(string, bool, ObjectAtk) dlg)
716 		{
717 			this.dlg = dlg;
718 			onStateChangeListeners ~= this;
719 		}
720 
721 		void remove(OnStateChangeDelegateWrapper source)
722 		{
723 			foreach(index, wrapper; onStateChangeListeners)
724 			{
725 				if (wrapper.handlerId == source.handlerId)
726 				{
727 					onStateChangeListeners[index] = null;
728 					onStateChangeListeners = std.algorithm.remove(onStateChangeListeners, index);
729 					break;
730 				}
731 			}
732 		}
733 	}
734 	OnStateChangeDelegateWrapper[] onStateChangeListeners;
735 
736 	/**
737 	 * The "state-change" signal is emitted when an object's state
738 	 * changes.  The detail value identifies the state type which has
739 	 * changed.
740 	 *
741 	 * Params:
742 	 *     arg1 = The name of the state which has changed
743 	 *     arg2 = A boolean which indicates whether the state has been set or unset.
744 	 */
745 	gulong addOnStateChange(void delegate(string, bool, ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
746 	{
747 		auto wrapper = new OnStateChangeDelegateWrapper(dlg);
748 		wrapper.handlerId = Signals.connectData(
749 			this,
750 			"state-change",
751 			cast(GCallback)&callBackStateChange,
752 			cast(void*)wrapper,
753 			cast(GClosureNotify)&callBackStateChangeDestroy,
754 			connectFlags);
755 		return wrapper.handlerId;
756 	}
757 
758 	extern(C) static void callBackStateChange(AtkObject* objectatkStruct, char* arg1, bool arg2, OnStateChangeDelegateWrapper wrapper)
759 	{
760 		wrapper.dlg(Str.toString(arg1), arg2, wrapper.outer);
761 	}
762 
763 	extern(C) static void callBackStateChangeDestroy(OnStateChangeDelegateWrapper wrapper, GClosure* closure)
764 	{
765 		wrapper.remove(wrapper);
766 	}
767 
768 	protected class OnVisibleDataChangedDelegateWrapper
769 	{
770 		void delegate(ObjectAtk) dlg;
771 		gulong handlerId;
772 
773 		this(void delegate(ObjectAtk) dlg)
774 		{
775 			this.dlg = dlg;
776 			onVisibleDataChangedListeners ~= this;
777 		}
778 
779 		void remove(OnVisibleDataChangedDelegateWrapper source)
780 		{
781 			foreach(index, wrapper; onVisibleDataChangedListeners)
782 			{
783 				if (wrapper.handlerId == source.handlerId)
784 				{
785 					onVisibleDataChangedListeners[index] = null;
786 					onVisibleDataChangedListeners = std.algorithm.remove(onVisibleDataChangedListeners, index);
787 					break;
788 				}
789 			}
790 		}
791 	}
792 	OnVisibleDataChangedDelegateWrapper[] onVisibleDataChangedListeners;
793 
794 	/**
795 	 * The "visible-data-changed" signal is emitted when the visual
796 	 * appearance of the object changed.
797 	 */
798 	gulong addOnVisibleDataChanged(void delegate(ObjectAtk) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
799 	{
800 		auto wrapper = new OnVisibleDataChangedDelegateWrapper(dlg);
801 		wrapper.handlerId = Signals.connectData(
802 			this,
803 			"visible-data-changed",
804 			cast(GCallback)&callBackVisibleDataChanged,
805 			cast(void*)wrapper,
806 			cast(GClosureNotify)&callBackVisibleDataChangedDestroy,
807 			connectFlags);
808 		return wrapper.handlerId;
809 	}
810 
811 	extern(C) static void callBackVisibleDataChanged(AtkObject* objectatkStruct, OnVisibleDataChangedDelegateWrapper wrapper)
812 	{
813 		wrapper.dlg(wrapper.outer);
814 	}
815 
816 	extern(C) static void callBackVisibleDataChangedDestroy(OnVisibleDataChangedDelegateWrapper wrapper, GClosure* closure)
817 	{
818 		wrapper.remove(wrapper);
819 	}
820 
821 	/**
822 	 * Get the #AtkRole type corresponding to a rolew name.
823 	 *
824 	 * Params:
825 	 *     name = a string which is the (non-localized) name of an ATK role.
826 	 *
827 	 * Returns: the #AtkRole enumerated type corresponding to the specified name,
828 	 *     or #ATK_ROLE_INVALID if no matching role is found.
829 	 */
830 	public static AtkRole roleForName(string name)
831 	{
832 		return atk_role_for_name(Str.toStringz(name));
833 	}
834 
835 	/**
836 	 * Gets the localized description string describing the #AtkRole @role.
837 	 *
838 	 * Params:
839 	 *     role = The #AtkRole whose localized name is required
840 	 *
841 	 * Returns: the localized string describing the AtkRole
842 	 */
843 	public static string roleGetLocalizedName(AtkRole role)
844 	{
845 		return Str.toString(atk_role_get_localized_name(role));
846 	}
847 
848 	/**
849 	 * Gets the description string describing the #AtkRole @role.
850 	 *
851 	 * Params:
852 	 *     role = The #AtkRole whose name is required
853 	 *
854 	 * Returns: the string describing the AtkRole
855 	 */
856 	public static string roleGetName(AtkRole role)
857 	{
858 		return Str.toString(atk_role_get_name(role));
859 	}
860 
861 	/**
862 	 * Registers the role specified by @name. @name must be a meaningful
863 	 * name. So it should not be empty, or consisting on whitespaces.
864 	 *
865 	 * Deprecated: Since 2.12. If your application/toolkit doesn't find a
866 	 * suitable role for a specific object defined at #AtkRole, please
867 	 * submit a bug in order to add a new role to the specification.
868 	 *
869 	 * Params:
870 	 *     name = a character string describing the new role.
871 	 *
872 	 * Returns: an #AtkRole for the new role if added
873 	 *     properly. ATK_ROLE_INVALID in case of error.
874 	 */
875 	public static AtkRole roleRegister(string name)
876 	{
877 		return atk_role_register(Str.toStringz(name));
878 	}
879 }