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 gtk.Accessible;
26 
27 private import atk.ObjectAtk;
28 private import gobject.ObjectG;
29 private import gtk.Widget;
30 private import gtk.c.functions;
31 public  import gtk.c.types;
32 public  import gtkc.gtktypes;
33 
34 
35 /**
36  * The #GtkAccessible class is the base class for accessible
37  * implementations for #GtkWidget subclasses. It is a thin
38  * wrapper around #AtkObject, which adds facilities for associating
39  * a widget with its accessible object.
40  * 
41  * An accessible implementation for a third-party widget should
42  * derive from #GtkAccessible and implement the suitable interfaces
43  * from ATK, such as #AtkText or #AtkSelection. To establish
44  * the connection between the widget class and its corresponding
45  * acccessible implementation, override the get_accessible vfunc
46  * in #GtkWidgetClass.
47  */
48 public class Accessible : ObjectAtk
49 {
50 	/** the main Gtk struct */
51 	protected GtkAccessible* gtkAccessible;
52 
53 	/** Get the main Gtk struct */
54 	public GtkAccessible* getAccessibleStruct(bool transferOwnership = false)
55 	{
56 		if (transferOwnership)
57 			ownedRef = false;
58 		return gtkAccessible;
59 	}
60 
61 	/** the main Gtk struct as a void* */
62 	protected override void* getStruct()
63 	{
64 		return cast(void*)gtkAccessible;
65 	}
66 
67 	protected override void setStruct(GObject* obj)
68 	{
69 		gtkAccessible = cast(GtkAccessible*)obj;
70 		super.setStruct(obj);
71 	}
72 
73 	/**
74 	 * Sets our main struct and passes it to the parent class.
75 	 */
76 	public this (GtkAccessible* gtkAccessible, bool ownedRef = false)
77 	{
78 		this.gtkAccessible = gtkAccessible;
79 		super(cast(AtkObject*)gtkAccessible, ownedRef);
80 	}
81 
82 
83 	/** */
84 	public static GType getType()
85 	{
86 		return gtk_accessible_get_type();
87 	}
88 
89 	/**
90 	 * This function specifies the callback function to be called
91 	 * when the widget corresponding to a GtkAccessible is destroyed.
92 	 *
93 	 * Deprecated: Use gtk_accessible_set_widget() and its vfuncs.
94 	 */
95 	public void connectWidgetDestroyed()
96 	{
97 		gtk_accessible_connect_widget_destroyed(gtkAccessible);
98 	}
99 
100 	/**
101 	 * Gets the #GtkWidget corresponding to the #GtkAccessible.
102 	 * The returned widget does not have a reference added, so
103 	 * you do not need to unref it.
104 	 *
105 	 * Returns: pointer to the #GtkWidget
106 	 *     corresponding to the #GtkAccessible, or %NULL.
107 	 *
108 	 * Since: 2.22
109 	 */
110 	public Widget getWidget()
111 	{
112 		auto p = gtk_accessible_get_widget(gtkAccessible);
113 
114 		if(p is null)
115 		{
116 			return null;
117 		}
118 
119 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
120 	}
121 
122 	/**
123 	 * Sets the #GtkWidget corresponding to the #GtkAccessible.
124 	 *
125 	 * @accessible will not hold a reference to @widget.
126 	 * It is the caller’s responsibility to ensure that when @widget
127 	 * is destroyed, the widget is unset by calling this function
128 	 * again with @widget set to %NULL.
129 	 *
130 	 * Params:
131 	 *     widget = a #GtkWidget or %NULL to unset
132 	 *
133 	 * Since: 2.22
134 	 */
135 	public void setWidget(Widget widget)
136 	{
137 		gtk_accessible_set_widget(gtkAccessible, (widget is null) ? null : widget.getWidgetStruct());
138 	}
139 }