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 
99 	public static GType getType()
100 	{
101 		return gtk_handle_box_get_type();
102 	}
103 
104 	/**
105 	 * Create a new handle box.
106 	 *
107 	 * Deprecated: #GtkHandleBox has been deprecated.
108 	 *
109 	 * Return: a new #GtkHandleBox.
110 	 *
111 	 * Throws: ConstructionException GTK+ fails to create the object.
112 	 */
113 	public this()
114 	{
115 		auto p = gtk_handle_box_new();
116 		
117 		if(p is null)
118 		{
119 			throw new ConstructionException("null returned by new");
120 		}
121 		
122 		this(cast(GtkHandleBox*) p);
123 	}
124 
125 	/**
126 	 * Whether the handlebox’s child is currently detached.
127 	 *
128 	 * Deprecated: #GtkHandleBox has been deprecated.
129 	 *
130 	 * Return: %TRUE if the child is currently detached, otherwise %FALSE
131 	 *
132 	 * Since: 2.14
133 	 */
134 	public bool getChildDetached()
135 	{
136 		return gtk_handle_box_get_child_detached(gtkHandleBox) != 0;
137 	}
138 
139 	/**
140 	 * Gets the handle position of the handle box. See
141 	 * gtk_handle_box_set_handle_position().
142 	 *
143 	 * Deprecated: #GtkHandleBox has been deprecated.
144 	 *
145 	 * Return: the current handle position.
146 	 */
147 	public GtkPositionType getHandlePosition()
148 	{
149 		return gtk_handle_box_get_handle_position(gtkHandleBox);
150 	}
151 
152 	/**
153 	 * Gets the type of shadow drawn around the handle box. See
154 	 * gtk_handle_box_set_shadow_type().
155 	 *
156 	 * Deprecated: #GtkHandleBox has been deprecated.
157 	 *
158 	 * Return: the type of shadow currently drawn around the handle box.
159 	 */
160 	public GtkShadowType getShadowType()
161 	{
162 		return gtk_handle_box_get_shadow_type(gtkHandleBox);
163 	}
164 
165 	/**
166 	 * Gets the edge used for determining reattachment of the handle box.
167 	 * See gtk_handle_box_set_snap_edge().
168 	 *
169 	 * Deprecated: #GtkHandleBox has been deprecated.
170 	 *
171 	 * Return: the edge used for determining reattachment, or
172 	 *     (GtkPositionType)-1 if this is determined (as per default)
173 	 *     from the handle position.
174 	 */
175 	public GtkPositionType getSnapEdge()
176 	{
177 		return gtk_handle_box_get_snap_edge(gtkHandleBox);
178 	}
179 
180 	/**
181 	 * Sets the side of the handlebox where the handle is drawn.
182 	 *
183 	 * Deprecated: #GtkHandleBox has been deprecated.
184 	 *
185 	 * Params:
186 	 *     position = the side of the handlebox where the handle should be drawn.
187 	 */
188 	public void setHandlePosition(GtkPositionType position)
189 	{
190 		gtk_handle_box_set_handle_position(gtkHandleBox, position);
191 	}
192 
193 	/**
194 	 * Sets the type of shadow to be drawn around the border
195 	 * of the handle box.
196 	 *
197 	 * Deprecated: #GtkHandleBox has been deprecated.
198 	 *
199 	 * Params:
200 	 *     type = the shadow type.
201 	 */
202 	public void setShadowType(GtkShadowType type)
203 	{
204 		gtk_handle_box_set_shadow_type(gtkHandleBox, type);
205 	}
206 
207 	/**
208 	 * Sets the snap edge of a handlebox. The snap edge is
209 	 * the edge of the detached child that must be aligned
210 	 * with the corresponding edge of the “ghost” left
211 	 * behind when the child was detached to reattach
212 	 * the torn-off window. Usually, the snap edge should
213 	 * be chosen so that it stays in the same place on
214 	 * the screen when the handlebox is torn off.
215 	 *
216 	 * If the snap edge is not set, then an appropriate value
217 	 * will be guessed from the handle position. If the
218 	 * handle position is %GTK_POS_RIGHT or %GTK_POS_LEFT,
219 	 * then the snap edge will be %GTK_POS_TOP, otherwise
220 	 * it will be %GTK_POS_LEFT.
221 	 *
222 	 * Deprecated: #GtkHandleBox has been deprecated.
223 	 *
224 	 * Params:
225 	 *     edge = the snap edge, or -1 to unset the value; in which
226 	 *         case GTK+ will try to guess an appropriate value
227 	 *         in the future.
228 	 */
229 	public void setSnapEdge(GtkPositionType edge)
230 	{
231 		gtk_handle_box_set_snap_edge(gtkHandleBox, edge);
232 	}
233 
234 	int[string] connectedSignals;
235 
236 	void delegate(Widget, HandleBox)[] onChildAttachedListeners;
237 	/**
238 	 * This signal is emitted when the contents of the
239 	 * handlebox are reattached to the main window.
240 	 *
241 	 * Deprecated: #GtkHandleBox has been deprecated.
242 	 *
243 	 * Params:
244 	 *     widget = the child widget of the handlebox.
245 	 *         (this argument provides no extra information
246 	 *         and is here only for backwards-compatibility)
247 	 */
248 	void addOnChildAttached(void delegate(Widget, HandleBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
249 	{
250 		if ( "child-attached" !in connectedSignals )
251 		{
252 			Signals.connectData(
253 				this,
254 				"child-attached",
255 				cast(GCallback)&callBackChildAttached,
256 				cast(void*)this,
257 				null,
258 				connectFlags);
259 			connectedSignals["child-attached"] = 1;
260 		}
261 		onChildAttachedListeners ~= dlg;
262 	}
263 	extern(C) static void callBackChildAttached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox _handlebox)
264 	{
265 		foreach ( void delegate(Widget, HandleBox) dlg; _handlebox.onChildAttachedListeners )
266 		{
267 			dlg(ObjectG.getDObject!(Widget)(widget), _handlebox);
268 		}
269 	}
270 
271 	void delegate(Widget, HandleBox)[] onChildDetachedListeners;
272 	/**
273 	 * This signal is emitted when the contents of the
274 	 * handlebox are detached from the main window.
275 	 *
276 	 * Deprecated: #GtkHandleBox has been deprecated.
277 	 *
278 	 * Params:
279 	 *     widget = the child widget of the handlebox.
280 	 *         (this argument provides no extra information
281 	 *         and is here only for backwards-compatibility)
282 	 */
283 	void addOnChildDetached(void delegate(Widget, HandleBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
284 	{
285 		if ( "child-detached" !in connectedSignals )
286 		{
287 			Signals.connectData(
288 				this,
289 				"child-detached",
290 				cast(GCallback)&callBackChildDetached,
291 				cast(void*)this,
292 				null,
293 				connectFlags);
294 			connectedSignals["child-detached"] = 1;
295 		}
296 		onChildDetachedListeners ~= dlg;
297 	}
298 	extern(C) static void callBackChildDetached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox _handlebox)
299 	{
300 		foreach ( void delegate(Widget, HandleBox) dlg; _handlebox.onChildDetachedListeners )
301 		{
302 			dlg(ObjectG.getDObject!(Widget)(widget), _handlebox);
303 		}
304 	}
305 }