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