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.HandleBox;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gobject.Signals;
30 private import gtk.Bin;
31 private import gtk.Widget;
32 public  import gtkc.gdktypes;
33 private import gtkc.gtk;
34 public  import gtkc.gtktypes;
35 
36 
37 /**
38  * The #GtkHandleBox widget allows a portion of a window to be "torn
39  * off". It is a bin widget which displays its child and a handle that
40  * the user can drag to tear off a separate window (the “float
41  * window”) containing the child widget. A thin
42  * “ghost” is drawn in the original location of the
43  * handlebox. By dragging the separate window back to its original
44  * location, it can be reattached.
45  * 
46  * When reattaching, the ghost and float window, must be aligned
47  * along one of the edges, the “snap edge”.
48  * This either can be specified by the application programmer
49  * explicitly, or GTK+ will pick a reasonable default based
50  * on the handle position.
51  * 
52  * To make detaching and reattaching the handlebox as minimally confusing
53  * as possible to the user, it is important to set the snap edge so that
54  * the snap edge does not move when the handlebox is deattached. For
55  * instance, if the handlebox is packed at the bottom of a VBox, then
56  * when the handlebox is detached, the bottom edge of the handlebox's
57  * allocation will remain fixed as the height of the handlebox shrinks,
58  * so the snap edge should be set to %GTK_POS_BOTTOM.
59  * 
60  * > #GtkHandleBox has been deprecated. It is very specialized, lacks features
61  * > to make it useful and most importantly does not fit well into modern
62  * > application design. Do not use it. There is no replacement.
63  */
64 public class HandleBox : Bin
65 {
66 	/** the main Gtk struct */
67 	protected GtkHandleBox* gtkHandleBox;
68 
69 	/** Get the main Gtk struct */
70 	public GtkHandleBox* getHandleBoxStruct()
71 	{
72 		return gtkHandleBox;
73 	}
74 
75 	/** the main Gtk struct as a void* */
76 	protected override void* getStruct()
77 	{
78 		return cast(void*)gtkHandleBox;
79 	}
80 
81 	protected override void setStruct(GObject* obj)
82 	{
83 		gtkHandleBox = cast(GtkHandleBox*)obj;
84 		super.setStruct(obj);
85 	}
86 
87 	/**
88 	 * Sets our main struct and passes it to the parent class.
89 	 */
90 	public this (GtkHandleBox* gtkHandleBox, bool ownedRef = false)
91 	{
92 		this.gtkHandleBox = gtkHandleBox;
93 		super(cast(GtkBin*)gtkHandleBox, ownedRef);
94 	}
95 
96 
97 	/** */
98 	public static GType getType()
99 	{
100 		return gtk_handle_box_get_type();
101 	}
102 
103 	/**
104 	 * Create a new handle box.
105 	 *
106 	 * Deprecated: #GtkHandleBox has been deprecated.
107 	 *
108 	 * Return: a new #GtkHandleBox.
109 	 *
110 	 * Throws: ConstructionException GTK+ fails to create the object.
111 	 */
112 	public this()
113 	{
114 		auto p = gtk_handle_box_new();
115 		
116 		if(p is null)
117 		{
118 			throw new ConstructionException("null returned by new");
119 		}
120 		
121 		this(cast(GtkHandleBox*) p);
122 	}
123 
124 	/**
125 	 * Whether the handlebox’s child is currently detached.
126 	 *
127 	 * Deprecated: #GtkHandleBox has been deprecated.
128 	 *
129 	 * Return: %TRUE if the child is currently detached, otherwise %FALSE
130 	 *
131 	 * Since: 2.14
132 	 */
133 	public bool getChildDetached()
134 	{
135 		return gtk_handle_box_get_child_detached(gtkHandleBox) != 0;
136 	}
137 
138 	/**
139 	 * Gets the handle position of the handle box. See
140 	 * gtk_handle_box_set_handle_position().
141 	 *
142 	 * Deprecated: #GtkHandleBox has been deprecated.
143 	 *
144 	 * Return: the current handle position.
145 	 */
146 	public GtkPositionType getHandlePosition()
147 	{
148 		return gtk_handle_box_get_handle_position(gtkHandleBox);
149 	}
150 
151 	/**
152 	 * Gets the type of shadow drawn around the handle box. See
153 	 * gtk_handle_box_set_shadow_type().
154 	 *
155 	 * Deprecated: #GtkHandleBox has been deprecated.
156 	 *
157 	 * Return: the type of shadow currently drawn around the handle box.
158 	 */
159 	public GtkShadowType getShadowType()
160 	{
161 		return gtk_handle_box_get_shadow_type(gtkHandleBox);
162 	}
163 
164 	/**
165 	 * Gets the edge used for determining reattachment of the handle box.
166 	 * See gtk_handle_box_set_snap_edge().
167 	 *
168 	 * Deprecated: #GtkHandleBox has been deprecated.
169 	 *
170 	 * Return: the edge used for determining reattachment, or
171 	 *     (GtkPositionType)-1 if this is determined (as per default)
172 	 *     from the handle position.
173 	 */
174 	public GtkPositionType getSnapEdge()
175 	{
176 		return gtk_handle_box_get_snap_edge(gtkHandleBox);
177 	}
178 
179 	/**
180 	 * Sets the side of the handlebox where the handle is drawn.
181 	 *
182 	 * Deprecated: #GtkHandleBox has been deprecated.
183 	 *
184 	 * Params:
185 	 *     position = the side of the handlebox where the handle should be drawn.
186 	 */
187 	public void setHandlePosition(GtkPositionType position)
188 	{
189 		gtk_handle_box_set_handle_position(gtkHandleBox, position);
190 	}
191 
192 	/**
193 	 * Sets the type of shadow to be drawn around the border
194 	 * of the handle box.
195 	 *
196 	 * Deprecated: #GtkHandleBox has been deprecated.
197 	 *
198 	 * Params:
199 	 *     type = the shadow type.
200 	 */
201 	public void setShadowType(GtkShadowType type)
202 	{
203 		gtk_handle_box_set_shadow_type(gtkHandleBox, type);
204 	}
205 
206 	/**
207 	 * Sets the snap edge of a handlebox. The snap edge is
208 	 * the edge of the detached child that must be aligned
209 	 * with the corresponding edge of the “ghost” left
210 	 * behind when the child was detached to reattach
211 	 * the torn-off window. Usually, the snap edge should
212 	 * be chosen so that it stays in the same place on
213 	 * the screen when the handlebox is torn off.
214 	 *
215 	 * If the snap edge is not set, then an appropriate value
216 	 * will be guessed from the handle position. If the
217 	 * handle position is %GTK_POS_RIGHT or %GTK_POS_LEFT,
218 	 * then the snap edge will be %GTK_POS_TOP, otherwise
219 	 * it will be %GTK_POS_LEFT.
220 	 *
221 	 * Deprecated: #GtkHandleBox has been deprecated.
222 	 *
223 	 * Params:
224 	 *     edge = the snap edge, or -1 to unset the value; in which
225 	 *         case GTK+ will try to guess an appropriate value
226 	 *         in the future.
227 	 */
228 	public void setSnapEdge(GtkPositionType edge)
229 	{
230 		gtk_handle_box_set_snap_edge(gtkHandleBox, edge);
231 	}
232 
233 	int[string] connectedSignals;
234 
235 	void delegate(Widget, HandleBox)[] onChildAttachedListeners;
236 	/**
237 	 * This signal is emitted when the contents of the
238 	 * handlebox are reattached to the main window.
239 	 *
240 	 * Deprecated: #GtkHandleBox has been deprecated.
241 	 *
242 	 * Params:
243 	 *     widget = the child widget of the handlebox.
244 	 *         (this argument provides no extra information
245 	 *         and is here only for backwards-compatibility)
246 	 */
247 	void addOnChildAttached(void delegate(Widget, HandleBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
248 	{
249 		if ( "child-attached" !in connectedSignals )
250 		{
251 			Signals.connectData(
252 				this,
253 				"child-attached",
254 				cast(GCallback)&callBackChildAttached,
255 				cast(void*)this,
256 				null,
257 				connectFlags);
258 			connectedSignals["child-attached"] = 1;
259 		}
260 		onChildAttachedListeners ~= dlg;
261 	}
262 	extern(C) static void callBackChildAttached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox _handlebox)
263 	{
264 		foreach ( void delegate(Widget, HandleBox) dlg; _handlebox.onChildAttachedListeners )
265 		{
266 			dlg(ObjectG.getDObject!(Widget)(widget), _handlebox);
267 		}
268 	}
269 
270 	void delegate(Widget, HandleBox)[] onChildDetachedListeners;
271 	/**
272 	 * This signal is emitted when the contents of the
273 	 * handlebox are detached from the main window.
274 	 *
275 	 * Deprecated: #GtkHandleBox has been deprecated.
276 	 *
277 	 * Params:
278 	 *     widget = the child widget of the handlebox.
279 	 *         (this argument provides no extra information
280 	 *         and is here only for backwards-compatibility)
281 	 */
282 	void addOnChildDetached(void delegate(Widget, HandleBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
283 	{
284 		if ( "child-detached" !in connectedSignals )
285 		{
286 			Signals.connectData(
287 				this,
288 				"child-detached",
289 				cast(GCallback)&callBackChildDetached,
290 				cast(void*)this,
291 				null,
292 				connectFlags);
293 			connectedSignals["child-detached"] = 1;
294 		}
295 		onChildDetachedListeners ~= dlg;
296 	}
297 	extern(C) static void callBackChildDetached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox _handlebox)
298 	{
299 		foreach ( void delegate(Widget, HandleBox) dlg; _handlebox.onChildDetachedListeners )
300 		{
301 			dlg(ObjectG.getDObject!(Widget)(widget), _handlebox);
302 		}
303 	}
304 }