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