2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
28 * strct = GtkHandleBox
56 import tango
.io
.Stdout
; // use the tango loging?
60 private import gtkc
.gtktypes
;
62 private import gtkc
.gtk
;
71 * The GtkHandleBox widget allows a portion of a window to be "torn
72 * off". It is a bin widget which displays its child and a handle that
73 * the user can drag to tear off a separate window (the float
74 * window) containing the child widget. A thin
75 * ghost is drawn in the original location of the
76 * handlebox. By dragging the separate window back to its original
77 * location, it can be reattached.
78 * When reattaching, the ghost and float window, must be aligned
79 * along one of the edges, the snap edge.
80 * This either can be specified by the application programmer
81 * explicitely, or GTK+ will pick a reasonable default based
82 * on the handle position.
83 * To make detaching and reattaching the handlebox as minimally confusing
84 * as possible to the user, it is important to set the snap edge so that
85 * the snap edge does not move when the handlebox is deattached. For
86 * instance, if the handlebox is packed at the bottom of a VBox, then
87 * when the handlebox is detached, the bottom edge of the handlebox's
88 * allocation will remain fixed as the height of the handlebox shrinks,
89 * so the snap edge should be set to GTK_POS_BOTTOM.
91 private import gtk
.Bin
;
92 public class HandleBox
: Bin
95 /** the main Gtk struct */
96 protected GtkHandleBox
* gtkHandleBox
;
99 public GtkHandleBox
* getHandleBoxStruct()
105 /** the main Gtk struct as a void* */
106 protected void* getStruct()
108 return cast(void*)gtkHandleBox
;
112 * Sets our main struct and passes it to the parent class
114 public this (GtkHandleBox
* gtkHandleBox
)
118 if ( gtkHandleBox
is null )
123 Stdout("struct gtkHandleBox is null on constructor").newline
;
127 printf("struct gtkHandleBox is null on constructor");
134 assert(gtkHandleBox
!is null, "struct gtkHandleBox is null on constructor");
136 super(cast(GtkBin
*)gtkHandleBox
);
137 this.gtkHandleBox
= gtkHandleBox
;
143 // imports for the signal processing
144 private import gobject
.Signals
;
145 private import gtkc
.gdktypes
;
146 int[char[]] connectedSignals
;
148 void delegate(GtkWidget
*, HandleBox
)[] onChildAttachedListeners
;
149 void addOnChildAttached(void delegate(GtkWidget
*, HandleBox
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
151 if ( !("child-attached" in connectedSignals
) )
156 cast(GCallback
)&callBackChildAttached
,
160 connectedSignals
["child-attached"] = 1;
162 onChildAttachedListeners
~= dlg
;
164 extern(C
) static void callBackChildAttached(GtkHandleBox
* handleboxStruct
, GtkWidget
* widget
, HandleBox handleBox
)
166 bool consumed
= false;
168 foreach ( void delegate(GtkWidget
*, HandleBox
) dlg
; handleBox
.onChildAttachedListeners
)
170 dlg(widget
, handleBox
);
176 void delegate(GtkWidget
*, HandleBox
)[] onChildDetachedListeners
;
177 void addOnChildDetached(void delegate(GtkWidget
*, HandleBox
) dlg
, ConnectFlags connectFlags
=cast(ConnectFlags
)0)
179 if ( !("child-detached" in connectedSignals
) )
184 cast(GCallback
)&callBackChildDetached
,
188 connectedSignals
["child-detached"] = 1;
190 onChildDetachedListeners
~= dlg
;
192 extern(C
) static void callBackChildDetached(GtkHandleBox
* handleboxStruct
, GtkWidget
* widget
, HandleBox handleBox
)
194 bool consumed
= false;
196 foreach ( void delegate(GtkWidget
*, HandleBox
) dlg
; handleBox
.onChildDetachedListeners
)
198 dlg(widget
, handleBox
);
207 * Create a new handle box.
209 * a new GtkHandleBox.
213 // GtkWidget* gtk_handle_box_new (void);
214 this(cast(GtkHandleBox
*)gtk_handle_box_new() );
218 * Sets the type of shadow to be drawn around the border
225 public void setShadowType(GtkShadowType type
)
227 // void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, GtkShadowType type);
228 gtk_handle_box_set_shadow_type(gtkHandleBox
, type
);
232 * Sets the side of the handlebox where the handle is drawn.
236 * the side of the handlebox where the handle should be drawn.
238 public void setHandlePosition(GtkPositionType position
)
240 // void gtk_handle_box_set_handle_position (GtkHandleBox *handle_box, GtkPositionType position);
241 gtk_handle_box_set_handle_position(gtkHandleBox
, position
);
245 * Sets the snap edge of a handlebox. The snap edge is
246 * the edge of the detached child that must be aligned
247 * with the corresponding edge of the "ghost" left
248 * behind when the child was detached to reattach
249 * the torn-off window. Usually, the snap edge should
250 * be chosen so that it stays in the same place on
251 * the screen when the handlebox is torn off.
252 * If the snap edge is not set, then an appropriate value
253 * will be guessed from the handle position. If the
254 * handle position is GTK_POS_RIGHT or GTK_POS_LEFT,
255 * then the snap edge will be GTK_POS_TOP, otherwise
256 * it will be GTK_POS_LEFT.
260 * the snap edge, or -1 to unset the value; in which
261 * case GTK+ will try to guess an appropriate value
264 public void setSnapEdge(GtkPositionType edge
)
266 // void gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, GtkPositionType edge);
267 gtk_handle_box_set_snap_edge(gtkHandleBox
, edge
);
271 * Gets the handle position of the handle box. See
272 * gtk_handle_box_set_handle_position().
276 * the current handle position.
278 public GtkPositionType
getHandlePosition()
280 // GtkPositionType gtk_handle_box_get_handle_position (GtkHandleBox *handle_box);
281 return gtk_handle_box_get_handle_position(gtkHandleBox
);
285 * Gets the type of shadow drawn around the handle box. See
286 * gtk_handle_box_set_shadow_type().
290 * the type of shadow currently drawn around the handle box.
292 public GtkShadowType
getShadowType()
294 // GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box);
295 return gtk_handle_box_get_shadow_type(gtkHandleBox
);
299 * Gets the edge used for determining reattachment of the handle box. See
300 * gtk_handle_box_set_snap_edge().
304 * the edge used for determining reattachment, or (GtkPositionType)-1 if this
305 * is determined (as per default) from the handle position.
307 * The "handle-position" property
308 * "handle-position" GtkPositionType : Read / Write
309 * Position of the handle relative to the child widget.
310 * Default value: GTK_POS_LEFT
312 public GtkPositionType
getSnapEdge()
314 // GtkPositionType gtk_handle_box_get_snap_edge (GtkHandleBox *handle_box);
315 return gtk_handle_box_get_snap_edge(gtkHandleBox
);