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