alternative to assert
[gtkD.git] / gtkD / src / gtk / Layout.d
blob3fee8870509b7868f4dfb348c2f3ab0cd05db50e
1 /*
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 = GtkLayout.html
26 * outPack = gtk
27 * outFile = Layout
28 * strct = GtkLayout
29 * realStrct=
30 * ctorStrct=
31 * clss = Layout
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_layout_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Adjustment
46 * - gtk.Widget
47 * structWrap:
48 * - GtkAdjustment* -> Adjustment
49 * - GtkWidget* -> Widget
50 * module aliases:
51 * local aliases:
54 module gtk.Layout;
56 version(noAssert)
58 version(Tango)
60 import tango.io.Stdout; // use the tango loging?
64 private import gtkc.gtktypes;
66 private import gtkc.gtk;
69 private import gtk.Adjustment;
70 private import gtk.Widget;
75 /**
76 * Description
77 * GtkLayout is similar to GtkDrawingArea in that it's a "blank slate"
78 * and doesn't do anything but paint a blank background by default. It's
79 * different in that it supports scrolling natively (you can add it to a
80 * GtkScrolledWindow), and it can contain child widgets, since it's a
81 * GtkContainer. However if you're just going to draw, a GtkDrawingArea
82 * is a better choice since it has lower overhead.
83 * When handling expose events on a GtkLayout, you must draw to
84 * GTK_LAYOUT (layout)->bin_window, rather than to
85 * GTK_WIDGET (layout)->window, as you would for a drawing
86 * area.
88 private import gtk.Container;
89 public class Layout : Container
92 /** the main Gtk struct */
93 protected GtkLayout* gtkLayout;
96 public GtkLayout* getLayoutStruct()
98 return gtkLayout;
102 /** the main Gtk struct as a void* */
103 protected void* getStruct()
105 return cast(void*)gtkLayout;
109 * Sets our main struct and passes it to the parent class
111 public this (GtkLayout* gtkLayout)
113 version(noAssert)
115 if ( gtkLayout is null )
117 int zero = 0;
118 version(Tango)
120 Stdout("struct gtkLayout is null on constructor").newline;
122 else
124 printf("struct gtkLayout is null on constructor");
126 zero = zero / zero;
129 else
131 assert(gtkLayout !is null, "struct gtkLayout is null on constructor");
133 super(cast(GtkContainer*)gtkLayout);
134 this.gtkLayout = gtkLayout;
140 // imports for the signal processing
141 private import gobject.Signals;
142 private import gtkc.gdktypes;
143 int[char[]] connectedSignals;
145 void delegate(Adjustment, Adjustment, Layout)[] onSetScrollAdjustmentsListeners;
146 void addOnSetScrollAdjustments(void delegate(Adjustment, Adjustment, Layout) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
148 if ( !("set-scroll-adjustments" in connectedSignals) )
150 Signals.connectData(
151 getStruct(),
152 "set-scroll-adjustments",
153 cast(GCallback)&callBackSetScrollAdjustments,
154 cast(void*)this,
155 null,
156 connectFlags);
157 connectedSignals["set-scroll-adjustments"] = 1;
159 onSetScrollAdjustmentsListeners ~= dlg;
161 extern(C) static void callBackSetScrollAdjustments(GtkLayout* layoutStruct, GtkAdjustment* arg1, GtkAdjustment* arg2, Layout layout)
163 bool consumed = false;
165 foreach ( void delegate(Adjustment, Adjustment, Layout) dlg ; layout.onSetScrollAdjustmentsListeners )
167 dlg(new Adjustment(arg1), new Adjustment(arg2), layout);
170 return consumed;
176 * Creates a new GtkLayout. Unless you have a specific adjustment
177 * you'd like the layout to use for scrolling, pass NULL for
178 * hadjustment and vadjustment.
179 * hadjustment:
180 * horizontal scroll adjustment, or NULL
181 * vadjustment:
182 * vertical scroll adjustment, or NULL
183 * Returns:
184 * a new GtkLayout
186 public this (Adjustment hadjustment, Adjustment vadjustment)
188 // GtkWidget* gtk_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment);
189 this(cast(GtkLayout*)gtk_layout_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()) );
193 * Adds child_widget to layout, at position (x,y).
194 * layout becomes the new parent container of child_widget.
195 * layout:
196 * a GtkLayout
197 * child_widget:
198 * child widget
199 * x:
200 * X position of child widget
201 * y:
202 * Y position of child widget
204 public void put(Widget childWidget, int x, int y)
206 // void gtk_layout_put (GtkLayout *layout, GtkWidget *child_widget, gint x, gint y);
207 gtk_layout_put(gtkLayout, (childWidget is null) ? null : childWidget.getWidgetStruct(), x, y);
211 * Moves a current child of layout to a new position.
212 * layout:
213 * a GtkLayout
214 * child_widget:
215 * a current child of layout
216 * x:
217 * X position to move to
218 * y:
219 * Y position to move to
221 public void move(Widget childWidget, int x, int y)
223 // void gtk_layout_move (GtkLayout *layout, GtkWidget *child_widget, gint x, gint y);
224 gtk_layout_move(gtkLayout, (childWidget is null) ? null : childWidget.getWidgetStruct(), x, y);
228 * Sets the size of the scrollable area of the layout.
229 * layout:
230 * a GtkLayout
231 * width:
232 * width of entire scrollable area
233 * height:
234 * height of entire scrollable area
236 public void setSize(uint width, uint height)
238 // void gtk_layout_set_size (GtkLayout *layout, guint width, guint height);
239 gtk_layout_set_size(gtkLayout, width, height);
243 * Gets the size that has been set on the layout, and that determines
244 * the total extents of the layout's scrollbar area. See
245 * gtk_layout_set_size().
246 * layout:
247 * a GtkLayout
248 * width:
249 * location to store the width set on layout, or NULL
250 * height:
251 * location to store the height set on layout, or NULL
253 public void getSize(uint* width, uint* height)
255 // void gtk_layout_get_size (GtkLayout *layout, guint *width, guint *height);
256 gtk_layout_get_size(gtkLayout, width, height);
260 * Warning
261 * gtk_layout_freeze is deprecated and should not be used in newly-written code.
262 * This is a deprecated function, it doesn't do anything useful.
263 * layout:
264 * a GtkLayout
266 public void freeze()
268 // void gtk_layout_freeze (GtkLayout *layout);
269 gtk_layout_freeze(gtkLayout);
273 * Warning
274 * gtk_layout_thaw is deprecated and should not be used in newly-written code.
275 * This is a deprecated function, it doesn't do anything useful.
276 * layout:
277 * a GtkLayout
279 public void thaw()
281 // void gtk_layout_thaw (GtkLayout *layout);
282 gtk_layout_thaw(gtkLayout);
286 * This function should only be called after the layout has been
287 * placed in a GtkScrolledWindow or otherwise configured for
288 * scrolling. It returns the GtkAdjustment used for communication
289 * between the horizontal scrollbar and layout.
290 * See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
291 * layout:
292 * a GtkLayout
293 * Returns:
294 * horizontal scroll adjustment
296 public Adjustment getHadjustment()
298 // GtkAdjustment* gtk_layout_get_hadjustment (GtkLayout *layout);
299 return new Adjustment( gtk_layout_get_hadjustment(gtkLayout) );
303 * This function should only be called after the layout has been
304 * placed in a GtkScrolledWindow or otherwise configured for
305 * scrolling. It returns the GtkAdjustment used for communication
306 * between the vertical scrollbar and layout.
307 * See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
308 * layout:
309 * a GtkLayout
310 * Returns:
311 * vertical scroll adjustment
313 public Adjustment getVadjustment()
315 // GtkAdjustment* gtk_layout_get_vadjustment (GtkLayout *layout);
316 return new Adjustment( gtk_layout_get_vadjustment(gtkLayout) );
320 * Sets the horizontal scroll adjustment for the layout.
321 * See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
322 * layout:
323 * a GtkLayout
324 * adjustment:
325 * new scroll adjustment
327 public void setHadjustment(Adjustment adjustment)
329 // void gtk_layout_set_hadjustment (GtkLayout *layout, GtkAdjustment *adjustment);
330 gtk_layout_set_hadjustment(gtkLayout, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
334 * Sets the vertical scroll adjustment for the layout.
335 * See GtkScrolledWindow, GtkScrollbar, GtkAdjustment for details.
336 * layout:
337 * a GtkLayout
338 * adjustment:
339 * new scroll adjustment
340 * Property Details
341 * The "hadjustment" property
342 * "hadjustment" GtkAdjustment : Read / Write
343 * The GtkAdjustment for the horizontal position.
345 public void setVadjustment(Adjustment adjustment)
347 // void gtk_layout_set_vadjustment (GtkLayout *layout, GtkAdjustment *adjustment);
348 gtk_layout_set_vadjustment(gtkLayout, (adjustment is null) ? null : adjustment.getAdjustmentStruct());