alternative to assert
[gtkD.git] / gtkD / src / gtk / Viewport.d
blob17b818e4ab2c3def775f2491e70ce23d2a7f7fe8
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 = GtkViewport.html
26 * outPack = gtk
27 * outFile = Viewport
28 * strct = GtkViewport
29 * realStrct=
30 * ctorStrct=
31 * clss = Viewport
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_viewport_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Adjustment
46 * structWrap:
47 * - GtkAdjustment* -> Adjustment
48 * module aliases:
49 * local aliases:
52 module gtk.Viewport;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gtkc.gtktypes;
64 private import gtkc.gtk;
67 private import gtk.Adjustment;
72 /**
73 * Description
75 private import gtk.Bin;
76 public class Viewport : Bin
79 /** the main Gtk struct */
80 protected GtkViewport* gtkViewport;
83 public GtkViewport* getViewportStruct()
85 return gtkViewport;
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gtkViewport;
95 /**
96 * Sets our main struct and passes it to the parent class
98 public this (GtkViewport* gtkViewport)
100 version(noAssert)
102 if ( gtkViewport is null )
104 int zero = 0;
105 version(Tango)
107 Stdout("struct gtkViewport is null on constructor").newline;
109 else
111 printf("struct gtkViewport is null on constructor");
113 zero = zero / zero;
116 else
118 assert(gtkViewport !is null, "struct gtkViewport is null on constructor");
120 super(cast(GtkBin*)gtkViewport);
121 this.gtkViewport = gtkViewport;
127 // imports for the signal processing
128 private import gobject.Signals;
129 private import gtkc.gdktypes;
130 int[char[]] connectedSignals;
132 void delegate(Adjustment, Adjustment, Viewport)[] onSetScrollAdjustmentsListeners;
133 void addOnSetScrollAdjustments(void delegate(Adjustment, Adjustment, Viewport) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
135 if ( !("set-scroll-adjustments" in connectedSignals) )
137 Signals.connectData(
138 getStruct(),
139 "set-scroll-adjustments",
140 cast(GCallback)&callBackSetScrollAdjustments,
141 cast(void*)this,
142 null,
143 connectFlags);
144 connectedSignals["set-scroll-adjustments"] = 1;
146 onSetScrollAdjustmentsListeners ~= dlg;
148 extern(C) static void callBackSetScrollAdjustments(GtkViewport* viewportStruct, GtkAdjustment* arg1, GtkAdjustment* arg2, Viewport viewport)
150 bool consumed = false;
152 foreach ( void delegate(Adjustment, Adjustment, Viewport) dlg ; viewport.onSetScrollAdjustmentsListeners )
154 dlg(new Adjustment(arg1), new Adjustment(arg2), viewport);
157 return consumed;
163 * Creates a new GtkViewport with the given adjustments.
164 * hadjustment:
165 * horizontal adjustment.
166 * vadjustment:
167 * vertical adjustment.
168 * Returns:
169 * a new GtkViewport.
171 public this (Adjustment hadjustment, Adjustment vadjustment)
173 // GtkWidget* gtk_viewport_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment);
174 this(cast(GtkViewport*)gtk_viewport_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()) );
178 * Returns the horizontal adjustment of the viewport.
179 * viewport:
180 * a GtkViewport.
181 * Returns:
182 * the horizontal adjustment of viewport.
184 public Adjustment getHadjustment()
186 // GtkAdjustment* gtk_viewport_get_hadjustment (GtkViewport *viewport);
187 return new Adjustment( gtk_viewport_get_hadjustment(gtkViewport) );
191 * Returns the vertical adjustment of the viewport.
192 * viewport:
193 * a GtkViewport.
194 * Returns:
195 * the vertical adjustment of viewport.
197 public Adjustment getVadjustment()
199 // GtkAdjustment* gtk_viewport_get_vadjustment (GtkViewport *viewport);
200 return new Adjustment( gtk_viewport_get_vadjustment(gtkViewport) );
204 * Sets the horizontal adjustment of the viewport.
205 * viewport:
206 * a GtkViewport.
207 * adjustment:
208 * a GtkAdjustment.
210 public void setHadjustment(Adjustment adjustment)
212 // void gtk_viewport_set_hadjustment (GtkViewport *viewport, GtkAdjustment *adjustment);
213 gtk_viewport_set_hadjustment(gtkViewport, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
217 * Sets the vertical adjustment of the viewport.
218 * viewport:
219 * a GtkViewport.
220 * adjustment:
221 * a GtkAdjustment.
223 public void setVadjustment(Adjustment adjustment)
225 // void gtk_viewport_set_vadjustment (GtkViewport *viewport, GtkAdjustment *adjustment);
226 gtk_viewport_set_vadjustment(gtkViewport, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
230 * Sets the shadow type of the viewport.
231 * viewport:
232 * a GtkViewport.
233 * type:
234 * the new shadow type.
236 public void setShadowType(GtkShadowType type)
238 // void gtk_viewport_set_shadow_type (GtkViewport *viewport, GtkShadowType type);
239 gtk_viewport_set_shadow_type(gtkViewport, type);
243 * Gets the shadow type of the GtkViewport. See
244 * gtk_viewport_set_shadow_type().
245 * viewport:
246 * a GtkViewport
247 * Returns:
248 * the shadow type
249 * Property Details
250 * The "hadjustment" property
251 * "hadjustment" GtkAdjustment : Read / Write / Construct
252 * The GtkAdjustment that determines the values of the horizontal position for this viewport.
254 public GtkShadowType getShadowType()
256 // GtkShadowType gtk_viewport_get_shadow_type (GtkViewport *viewport);
257 return gtk_viewport_get_shadow_type(gtkViewport);