I've no idea here...
[gtkD.git] / src / gtk / Paned.d
blob015051b56fff828ccaa748354e0392dd11aea4d3
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 = GtkPaned.html
26 * outPack = gtk
27 * outFile = Paned
28 * strct = GtkPaned
29 * realStrct=
30 * ctorStrct=
31 * clss = Paned
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_paned_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Widget
46 * structWrap:
47 * - GtkWidget* -> Widget
48 * local aliases:
51 module gtk.Paned;
53 private import gtk.gtktypes;
55 private import lib.gtk;
57 private import gtk.Widget;
59 /**
60 * Description
61 * GtkPaned is the base class for widgets with two panes,
62 * arranged either horizontally (GtkHPaned) or
63 * vertically (GtkVPaned). Child widgets are
64 * added to the panes of the widget with
65 * gtk_paned_pack1() and gtk_paned_pack2(). The division
66 * beween the two children is set by default from the
67 * size requests of the children, but it can be adjusted
68 * by the user.
69 * A paned widget draws a separator between the two
70 * child widgets and a small handle that the user
71 * can drag to adjust the division. It does not
72 * draw any relief around the children or around
73 * the separator. (The space in which the separator
74 * is called the gutter.) Often, it is useful
75 * to put each child inside a GtkFrame with the
76 * shadow type set to GTK_SHADOW_IN so that the
77 * gutter appears as a ridge.
78 * Each child has two options that can be set,
79 * resize and shrink. If resize is true, then when the
80 * GtkPaned is resized, that child will expand
81 * or shrink along with the paned widget. If shrink
82 * is true, then when that child can be made smaller
83 * than its requisition by the user. Setting shrink
84 * to FALSE allows the application to set a minimum
85 * size. If resize is false for both children, then
86 * this is treated as if resize is true for both
87 * children.
88 * The application can set the position of the slider
89 * as if it were set by the user, by calling
90 * gtk_paned_set_position().
91 * Example1.Creating a paned widget with minimum sizes.
92 * GtkWidget *hpaned = gtk_hpaned_new ();
93 * GtkWidget *frame1 = gtk_frame_new (NULL);
94 * GtkWidget *frame2 = gtk_frame_new (NULL);
95 * gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
96 * gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
97 * gtk_widget_set_size_request (hpaned, 200 + GTK_PANED (hpaned)->gutter_size, -1);
98 * gtk_paned_pack1 (GTK_PANED (hpaned), frame1, TRUE, FALSE);
99 * gtk_widget_set_size_request (frame1, 50, -1);
100 * gtk_paned_pack2 (GTK_PANED (hpaned), frame2, FALSE, FALSE);
101 * gtk_widget_set_size_request (frame2, 50, -1);
103 private import gtk.Container;
104 public class Paned : Container
107 /** the main Gtk struct */
108 protected GtkPaned* gtkPaned;
111 public GtkPaned* getPanedStruct()
113 return gtkPaned;
117 /** the main Gtk struct as a void* */
118 protected void* getStruct()
120 return cast(void*)gtkPaned;
124 * Sets our main struct and passes it to the parent class
126 public this (GtkPaned* gtkPaned)
128 super(cast(GtkContainer*)gtkPaned);
129 this.gtkPaned = gtkPaned;
132 public void add(Widget child1, Widget child2)
134 add1(child1);
135 add2(child2);
141 // imports for the signal processing
142 private import gobject.Signals;
143 private import gdk.gdktypes;
144 int[char[]] connectedSignals;
146 gboolean delegate(Paned)[] onAcceptPositionListeners;
147 void addOnAcceptPosition(gboolean delegate(Paned) dlg)
149 if ( !("accept-position" in connectedSignals) )
151 Signals.connectData(
152 getStruct(),
153 "accept-position",
154 cast(GCallback)&callBackAcceptPosition,
155 this,
156 null,
157 cast(ConnectFlags)0);
158 connectedSignals["accept-position"] = 1;
160 onAcceptPositionListeners ~= dlg;
162 extern(C) static void callBackAcceptPosition(GtkPaned* panedStruct, Paned paned)
164 bit consumed = false;
166 foreach ( gboolean delegate(Paned) dlg ; paned.onAcceptPositionListeners )
168 dlg(paned);
171 return consumed;
174 gboolean delegate(Paned)[] onCancelPositionListeners;
175 void addOnCancelPosition(gboolean delegate(Paned) dlg)
177 if ( !("cancel-position" in connectedSignals) )
179 Signals.connectData(
180 getStruct(),
181 "cancel-position",
182 cast(GCallback)&callBackCancelPosition,
183 this,
184 null,
185 cast(ConnectFlags)0);
186 connectedSignals["cancel-position"] = 1;
188 onCancelPositionListeners ~= dlg;
190 extern(C) static void callBackCancelPosition(GtkPaned* panedStruct, Paned paned)
192 bit consumed = false;
194 foreach ( gboolean delegate(Paned) dlg ; paned.onCancelPositionListeners )
196 dlg(paned);
199 return consumed;
202 gboolean delegate(gboolean, Paned)[] onCycleChildFocusListeners;
203 void addOnCycleChildFocus(gboolean delegate(gboolean, Paned) dlg)
205 if ( !("cycle-child-focus" in connectedSignals) )
207 Signals.connectData(
208 getStruct(),
209 "cycle-child-focus",
210 cast(GCallback)&callBackCycleChildFocus,
211 this,
212 null,
213 cast(ConnectFlags)0);
214 connectedSignals["cycle-child-focus"] = 1;
216 onCycleChildFocusListeners ~= dlg;
218 extern(C) static void callBackCycleChildFocus(GtkPaned* panedStruct, gboolean arg1, Paned paned)
220 bit consumed = false;
222 foreach ( gboolean delegate(gboolean, Paned) dlg ; paned.onCycleChildFocusListeners )
224 dlg(arg1, paned);
227 return consumed;
230 gboolean delegate(gboolean, Paned)[] onCycleHandleFocusListeners;
231 void addOnCycleHandleFocus(gboolean delegate(gboolean, Paned) dlg)
233 if ( !("cycle-handle-focus" in connectedSignals) )
235 Signals.connectData(
236 getStruct(),
237 "cycle-handle-focus",
238 cast(GCallback)&callBackCycleHandleFocus,
239 this,
240 null,
241 cast(ConnectFlags)0);
242 connectedSignals["cycle-handle-focus"] = 1;
244 onCycleHandleFocusListeners ~= dlg;
246 extern(C) static void callBackCycleHandleFocus(GtkPaned* panedStruct, gboolean arg1, Paned paned)
248 bit consumed = false;
250 foreach ( gboolean delegate(gboolean, Paned) dlg ; paned.onCycleHandleFocusListeners )
252 dlg(arg1, paned);
255 return consumed;
258 gboolean delegate(GtkScrollType, Paned)[] onMoveHandleListeners;
259 void addOnMoveHandle(gboolean delegate(GtkScrollType, Paned) dlg)
261 if ( !("move-handle" in connectedSignals) )
263 Signals.connectData(
264 getStruct(),
265 "move-handle",
266 cast(GCallback)&callBackMoveHandle,
267 this,
268 null,
269 cast(ConnectFlags)0);
270 connectedSignals["move-handle"] = 1;
272 onMoveHandleListeners ~= dlg;
274 extern(C) static void callBackMoveHandle(GtkPaned* panedStruct, GtkScrollType arg1, Paned paned)
276 bit consumed = false;
278 foreach ( gboolean delegate(GtkScrollType, Paned) dlg ; paned.onMoveHandleListeners )
280 dlg(arg1, paned);
283 return consumed;
286 gboolean delegate(Paned)[] onToggleHandleFocusListeners;
287 void addOnToggleHandleFocus(gboolean delegate(Paned) dlg)
289 if ( !("toggle-handle-focus" in connectedSignals) )
291 Signals.connectData(
292 getStruct(),
293 "toggle-handle-focus",
294 cast(GCallback)&callBackToggleHandleFocus,
295 this,
296 null,
297 cast(ConnectFlags)0);
298 connectedSignals["toggle-handle-focus"] = 1;
300 onToggleHandleFocusListeners ~= dlg;
302 extern(C) static void callBackToggleHandleFocus(GtkPaned* panedStruct, Paned paned)
304 bit consumed = false;
306 foreach ( gboolean delegate(Paned) dlg ; paned.onToggleHandleFocusListeners )
308 dlg(paned);
311 return consumed;
317 * Adds a child to the top or left pane with
318 * default parameters. This is equivalent
319 * to gtk_paned_pack1 (paned, child, FALSE, TRUE).
320 * paned:
321 * a paned widget
322 * child:
323 * the child to add
325 public void add1(Widget child)
327 // void gtk_paned_add1 (GtkPaned *paned, GtkWidget *child);
328 gtk_paned_add1(gtkPaned, (child is null) ? null : child.getWidgetStruct());
332 * Adds a child to the bottom or right pane with default
333 * parameters. This is equivalent to
334 * gtk_paned_pack2 (paned, child, TRUE, TRUE).
335 * paned:
336 * a paned widget
337 * child:
338 * the child to add
340 public void add2(Widget child)
342 // void gtk_paned_add2 (GtkPaned *paned, GtkWidget *child);
343 gtk_paned_add2(gtkPaned, (child is null) ? null : child.getWidgetStruct());
348 * Adds a child to the top or left pane.
349 * paned:
350 * a paned widget
351 * child:
352 * the child to add
353 * resize:
354 * should this child expand when the paned widget is resized.
355 * shrink:
356 * can this child be made smaller than its requisition.
358 public void pack1(Widget child, int resize, int shrink)
360 // void gtk_paned_pack1 (GtkPaned *paned, GtkWidget *child, gboolean resize, gboolean shrink);
361 gtk_paned_pack1(gtkPaned, (child is null) ? null : child.getWidgetStruct(), resize, shrink);
365 * Adds a child to the bottom or right pane.
366 * paned:
367 * a paned widget
368 * child:
369 * the child to add
370 * resize:
371 * should this child expand when the paned widget is resized.
372 * shrink:
373 * can this child be made smaller than its requisition.
375 public void pack2(Widget child, int resize, int shrink)
377 // void gtk_paned_pack2 (GtkPaned *paned, GtkWidget *child, gboolean resize, gboolean shrink);
378 gtk_paned_pack2(gtkPaned, (child is null) ? null : child.getWidgetStruct(), resize, shrink);
382 * Obtains the first child of the paned widget.
383 * paned:
384 * a GtkPaned widget
385 * Returns:
386 * first child, or NULL if it is not set.
387 * Since 2.4
389 public Widget getChild1()
391 // GtkWidget* gtk_paned_get_child1 (GtkPaned *paned);
392 return new Widget( gtk_paned_get_child1(gtkPaned) );
396 * Obtains the second child of the paned widget.
397 * paned:
398 * a GtkPaned widget
399 * Returns:
400 * second child, or NULL if it is not set.
401 * Since 2.4
403 public Widget getChild2()
405 // GtkWidget* gtk_paned_get_child2 (GtkPaned *paned);
406 return new Widget( gtk_paned_get_child2(gtkPaned) );
411 * Sets the position of the divider between the two panes.
412 * paned:
413 * a GtkPaned widget
414 * position:
415 * pixel position of divider, a negative value means that the position
416 * is unset.
418 public void setPosition(int position)
420 // void gtk_paned_set_position (GtkPaned *paned, gint position);
421 gtk_paned_set_position(gtkPaned, position);
425 * Obtains the position of the divider between the two panes.
426 * paned:
427 * a GtkPaned widget
428 * Returns:
429 * position of the divider
430 * Property Details
431 * The "max-position" property
432 * "max-position" gint : Read
433 * The largest possible value for the position property. This property is derived from the
434 * size and shrinkability of the widget's children.
435 * Allowed values: >= 0
436 * Default value: 2147483647
437 * Since 2.4
439 public int getPosition()
441 // gint gtk_paned_get_position (GtkPaned *paned);
442 return gtk_paned_get_position(gtkPaned);