alternative to assert
[gtkD.git] / src / gtk / HandleBox.d
blobd50fb71f51ac90fd64bacfef9608924fd4b0ef3b
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkHandleBox.html
26 * outPack = gtk
27 * outFile = HandleBox
28 * strct = GtkHandleBox
29 * realStrct=
30 * ctorStrct=
31 * clss = HandleBox
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_handle_box_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * structWrap:
46 * local aliases:
49 module gtk.HandleBox;
51 private import gtk.gtktypes;
53 private import lib.gtk;
56 /**
57 * Description
58 * The GtkHandleBox widget allows a portion of a window to be "torn
59 * off". It is a bin widget which displays its child and a handle that
60 * the user can drag to tear off a separate window (the float
61 * window) containing the child widget. A thin
62 * ghost is drawn in the original location of the
63 * handlebox. By dragging the separate window back to its original
64 * location, it can be reattached.
65 * When reattaching, the ghost and float window, must be aligned
66 * along one of the edges, the snap edge.
67 * This either can be specified by the application programmer
68 * explicitely, or GTK+ will pick a reasonable default based
69 * on the handle position.
70 * To make detaching and reattaching the handlebox as minimally confusing
71 * as possible to the user, it is important to set the snap edge so that
72 * the snap edge does not move when the handlebox is deattached. For
73 * instance, if the handlebox is packed at the bottom of a VBox, then
74 * when the handlebox is detached, the bottom edge of the handlebox's
75 * allocation will remain fixed as the height of the handlebox shrinks,
76 * so the snap edge should be set to GTK_POS_BOTTOM.
78 private import gtk.Bin;
79 public class HandleBox : Bin
82 /** the main Gtk struct */
83 protected GtkHandleBox* gtkHandleBox;
86 public GtkHandleBox* getHandleBoxStruct()
88 return gtkHandleBox;
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)gtkHandleBox;
98 /**
99 * Sets our main struct and passes it to the parent class
101 public this (GtkHandleBox* gtkHandleBox)
103 super(cast(GtkBin*)gtkHandleBox);
104 this.gtkHandleBox = gtkHandleBox;
110 // imports for the signal processing
111 private import gobject.Signals;
112 private import gdk.gdktypes;
113 int[char[]] connectedSignals;
115 void delegate(GtkWidget*, HandleBox)[] onChildAttachedListeners;
116 void addOnChildAttached(void delegate(GtkWidget*, HandleBox) dlg)
118 if ( !("child-attached" in connectedSignals) )
120 Signals.connectData(
121 getStruct(),
122 "child-attached",
123 cast(GCallback)&callBackChildAttached,
124 this,
125 null,
126 cast(ConnectFlags)0);
127 connectedSignals["child-attached"] = 1;
129 onChildAttachedListeners ~= dlg;
131 extern(C) static void callBackChildAttached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox handleBox)
133 bit consumed = false;
135 foreach ( void delegate(GtkWidget*, HandleBox) dlg ; handleBox.onChildAttachedListeners )
137 dlg(widget, handleBox);
140 return consumed;
143 void delegate(GtkWidget*, HandleBox)[] onChildDetachedListeners;
144 void addOnChildDetached(void delegate(GtkWidget*, HandleBox) dlg)
146 if ( !("child-detached" in connectedSignals) )
148 Signals.connectData(
149 getStruct(),
150 "child-detached",
151 cast(GCallback)&callBackChildDetached,
152 this,
153 null,
154 cast(ConnectFlags)0);
155 connectedSignals["child-detached"] = 1;
157 onChildDetachedListeners ~= dlg;
159 extern(C) static void callBackChildDetached(GtkHandleBox* handleboxStruct, GtkWidget* widget, HandleBox handleBox)
161 bit consumed = false;
163 foreach ( void delegate(GtkWidget*, HandleBox) dlg ; handleBox.onChildDetachedListeners )
165 dlg(widget, handleBox);
168 return consumed;
174 * Create a new handle box.
175 * Returns:
176 * a new GtkHandleBox.
178 public this ()
180 // GtkWidget* gtk_handle_box_new (void);
181 this(cast(GtkHandleBox*)gtk_handle_box_new() );
185 * Sets the type of shadow to be drawn around the border
186 * of the handle box.
187 * handle_box:
188 * a GtkHandleBox
189 * type:
190 * the shadow type.
192 public void setShadowType(GtkShadowType type)
194 // void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, GtkShadowType type);
195 gtk_handle_box_set_shadow_type(gtkHandleBox, type);
199 * Sets the side of the handlebox where the handle is drawn.
200 * handle_box:
201 * a GtkHandleBox
202 * position:
203 * the side of the handlebox where the handle should be drawn.
205 public void setHandlePosition(GtkPositionType position)
207 // void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, GtkPositionType position);
208 gtk_handle_box_set_handle_position(gtkHandleBox, position);
212 * Sets the snap edge of a handlebox. The snap edge is
213 * the edge of the detached child that must be aligned
214 * with the corresponding edge of the "ghost" left
215 * behind when the child was detached to reattach
216 * the torn-off window. Usually, the snap edge should
217 * be chosen so that it stays in the same place on
218 * the screen when the handlebox is torn off.
219 * If the snap edge is not set, then an appropriate value
220 * will be guessed from the handle position. If the
221 * handle position is GTK_POS_RIGHT or GTK_POS_LEFT,
222 * then the snap edge will be GTK_POS_TOP, otherwise
223 * it will be GTK_POS_LEFT.
224 * handle_box:
225 * a GtkHandleBox
226 * edge:
227 * the snap edge, or -1 to unset the value; in which
228 * case GTK+ will try to guess an appropriate value
229 * in the future.
231 public void setSnapEdge(GtkPositionType edge)
233 // void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, GtkPositionType edge);
234 gtk_handle_box_set_snap_edge(gtkHandleBox, edge);
238 * Gets the handle position of the handle box. See
239 * gtk_handle_box_set_handle_position().
240 * handle_box:
241 * a GtkHandleBox
242 * Returns:
243 * the current handle position.
245 public GtkPositionType getHandlePosition()
247 // GtkPositionType gtk_handle_box_get_handle_position (GtkHandleBox *handle_box);
248 return gtk_handle_box_get_handle_position(gtkHandleBox);
252 * Gets the type of shadow drawn around the handle box. See
253 * gtk_handle_box_set_shadow_type().
254 * handle_box:
255 * a GtkHandleBox
256 * Returns:
257 * the type of shadow currently drawn around the handle box.
259 public GtkShadowType getShadowType()
261 // GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box);
262 return gtk_handle_box_get_shadow_type(gtkHandleBox);
266 * Gets the edge used for determining reattachment of the handle box. See
267 * gtk_handle_box_set_snap_edge().
268 * handle_box:
269 * a GtkHandleBox
270 * Returns:
271 * the edge used for determining reattachment, or (GtkPositionType)-1 if this
272 * is determined (as per default) from the handle position.
273 * Property Details
274 * The "handle-position" property
275 * "handle-position" GtkPositionType : Read / Write
276 * Position of the handle relative to the child widget.
277 * Default value: GTK_POS_LEFT
279 public GtkPositionType getSnapEdge()
281 // GtkPositionType gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box);
282 return gtk_handle_box_get_snap_edge(gtkHandleBox);