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 	public static GType getType()
82 	{
83 		return gtk_accessible_get_type();
84 	}
85 
86 	/**
87 	 * This function specifies the callback function to be called
88 	 * when the widget corresponding to a GtkAccessible is destroyed.
89 	 *
90 	 * Deprecated: Use gtk_accessible_set_widget() and its vfuncs.
91 	 */
92 	public void connectWidgetDestroyed()
93 	{
94 		gtk_accessible_connect_widget_destroyed(gtkAccessible);
95 	}
96 
97 	/**
98 	 * Gets the #GtkWidget corresponding to the #GtkAccessible.
99 	 * The returned widget does not have a reference added, so
100 	 * you do not need to unref it.
101 	 *
102 	 * Return: pointer to the #GtkWidget
103 	 *     corresponding to the #GtkAccessible, or %NULL.
104 	 *
105 	 * Since: 2.22
106 	 */
107 	public Widget getWidget()
108 	{
109 		auto p = gtk_accessible_get_widget(gtkAccessible);
110 		
111 		if(p is null)
112 		{
113 			return null;
114 		}
115 		
116 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
117 	}
118 
119 	/**
120 	 * Sets the #GtkWidget corresponding to the #GtkAccessible.
121 	 *
122 	 * @accessible will not hold a reference to @widget.
123 	 * It is the caller’s responsibility to ensure that when @widget
124 	 * is destroyed, the widget is unset by calling this function
125 	 * again with @widget set to %NULL.
126 	 *
127 	 * Params:
128 	 *     widget = a #GtkWidget or %NULL to unset
129 	 *
130 	 * Since: 2.22
131 	 */
132 	public void setWidget(Widget widget)
133 	{
134 		gtk_accessible_set_widget(gtkAccessible, (widget is null) ? null : widget.getWidgetStruct());
135 	}
136 }