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