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(bool transferOwnership = false)
54 	{
55 		if (transferOwnership)
56 			ownedRef = false;
57 		return gtkAccessible;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)gtkAccessible;
64 	}
65 
66 	protected override void setStruct(GObject* obj)
67 	{
68 		gtkAccessible = cast(GtkAccessible*)obj;
69 		super.setStruct(obj);
70 	}
71 
72 	/**
73 	 * Sets our main struct and passes it to the parent class.
74 	 */
75 	public this (GtkAccessible* gtkAccessible, bool ownedRef = false)
76 	{
77 		this.gtkAccessible = gtkAccessible;
78 		super(cast(AtkObject*)gtkAccessible, ownedRef);
79 	}
80 
81 
82 	/** */
83 	public static GType getType()
84 	{
85 		return gtk_accessible_get_type();
86 	}
87 
88 	/**
89 	 * This function specifies the callback function to be called
90 	 * when the widget corresponding to a GtkAccessible is destroyed.
91 	 *
92 	 * Deprecated: Use gtk_accessible_set_widget() and its vfuncs.
93 	 */
94 	public void connectWidgetDestroyed()
95 	{
96 		gtk_accessible_connect_widget_destroyed(gtkAccessible);
97 	}
98 
99 	/**
100 	 * Gets the #GtkWidget corresponding to the #GtkAccessible.
101 	 * The returned widget does not have a reference added, so
102 	 * you do not need to unref it.
103 	 *
104 	 * Returns: pointer to the #GtkWidget
105 	 *     corresponding to the #GtkAccessible, or %NULL.
106 	 *
107 	 * Since: 2.22
108 	 */
109 	public Widget getWidget()
110 	{
111 		auto p = gtk_accessible_get_widget(gtkAccessible);
112 		
113 		if(p is null)
114 		{
115 			return null;
116 		}
117 		
118 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
119 	}
120 
121 	/**
122 	 * Sets the #GtkWidget corresponding to the #GtkAccessible.
123 	 *
124 	 * @accessible will not hold a reference to @widget.
125 	 * It is the caller’s responsibility to ensure that when @widget
126 	 * is destroyed, the widget is unset by calling this function
127 	 * again with @widget set to %NULL.
128 	 *
129 	 * Params:
130 	 *     widget = a #GtkWidget or %NULL to unset
131 	 *
132 	 * Since: 2.22
133 	 */
134 	public void setWidget(Widget widget)
135 	{
136 		gtk_accessible_set_widget(gtkAccessible, (widget is null) ? null : widget.getWidgetStruct());
137 	}
138 }