alternative to assert
[gtkD.git] / src / gtk / Range.d
blobdfdcd79bc6ddb00ac03d2e05d69f37cf8594bb5c
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 = GtkRange.html
26 * outPack = gtk
27 * outFile = Range
28 * strct = GtkRange
29 * realStrct=
30 * ctorStrct=
31 * clss = Range
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_range_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Adjustment
46 * structWrap:
47 * - GtkAdjustment* -> Adjustment
48 * local aliases:
51 module gtk.Range;
53 private import gtk.gtktypes;
55 private import lib.gtk;
57 private import gtk.Adjustment;
59 /**
60 * Description
62 private import gtk.Widget;
63 public class Range : Widget
66 /** the main Gtk struct */
67 protected GtkRange* gtkRange;
70 public GtkRange* getRangeStruct()
72 return gtkRange;
76 /** the main Gtk struct as a void* */
77 protected void* getStruct()
79 return cast(void*)gtkRange;
82 /**
83 * Sets our main struct and passes it to the parent class
85 public this (GtkRange* gtkRange)
87 super(cast(GtkWidget*)gtkRange);
88 this.gtkRange = gtkRange;
91 /**
94 // imports for the signal processing
95 private import gobject.Signals;
96 private import gdk.gdktypes;
97 int[char[]] connectedSignals;
99 void delegate(gdouble, Range)[] onAdjustBoundsListeners;
100 void addOnAdjustBounds(void delegate(gdouble, Range) dlg)
102 if ( !("adjust-bounds" in connectedSignals) )
104 Signals.connectData(
105 getStruct(),
106 "adjust-bounds",
107 cast(GCallback)&callBackAdjustBounds,
108 this,
109 null,
110 cast(ConnectFlags)0);
111 connectedSignals["adjust-bounds"] = 1;
113 onAdjustBoundsListeners ~= dlg;
115 extern(C) static void callBackAdjustBounds(GtkRange* rangeStruct, gdouble arg1, Range range)
117 bit consumed = false;
119 foreach ( void delegate(gdouble, Range) dlg ; range.onAdjustBoundsListeners )
121 dlg(arg1, range);
124 return consumed;
127 gboolean delegate(GtkScrollType, gdouble, Range)[] onChangeValueListeners;
128 void addOnChangeValue(gboolean delegate(GtkScrollType, gdouble, Range) dlg)
130 if ( !("change-value" in connectedSignals) )
132 Signals.connectData(
133 getStruct(),
134 "change-value",
135 cast(GCallback)&callBackChangeValue,
136 this,
137 null,
138 cast(ConnectFlags)0);
139 connectedSignals["change-value"] = 1;
141 onChangeValueListeners ~= dlg;
143 extern(C) static void callBackChangeValue(GtkRange* rangeStruct, GtkScrollType scroll, gdouble value, Range range)
145 bit consumed = false;
147 foreach ( gboolean delegate(GtkScrollType, gdouble, Range) dlg ; range.onChangeValueListeners )
149 dlg(scroll, value, range);
152 return consumed;
155 void delegate(GtkScrollType, Range)[] onMoveSliderListeners;
156 void addOnMoveSlider(void delegate(GtkScrollType, Range) dlg)
158 if ( !("move-slider" in connectedSignals) )
160 Signals.connectData(
161 getStruct(),
162 "move-slider",
163 cast(GCallback)&callBackMoveSlider,
164 this,
165 null,
166 cast(ConnectFlags)0);
167 connectedSignals["move-slider"] = 1;
169 onMoveSliderListeners ~= dlg;
171 extern(C) static void callBackMoveSlider(GtkRange* rangeStruct, GtkScrollType arg1, Range range)
173 bit consumed = false;
175 foreach ( void delegate(GtkScrollType, Range) dlg ; range.onMoveSliderListeners )
177 dlg(arg1, range);
180 return consumed;
183 void delegate(Range)[] onValueChangedListeners;
184 void addOnValueChanged(void delegate(Range) dlg)
186 if ( !("value-changed" in connectedSignals) )
188 Signals.connectData(
189 getStruct(),
190 "value-changed",
191 cast(GCallback)&callBackValueChanged,
192 this,
193 null,
194 cast(ConnectFlags)0);
195 connectedSignals["value-changed"] = 1;
197 onValueChangedListeners ~= dlg;
199 extern(C) static void callBackValueChanged(GtkRange* rangeStruct, Range range)
201 bit consumed = false;
203 foreach ( void delegate(Range) dlg ; range.onValueChangedListeners )
205 dlg(range);
208 return consumed;
214 * Get the GtkAdjustment which is the "model" object for GtkRange.
215 * See gtk_range_set_adjustment() for details.
216 * The return value does not have a reference added, so should not
217 * be unreferenced.
218 * range:
219 * a GtkRange
220 * Returns:
221 * a GtkAdjustment
223 public Adjustment getAdjustment()
225 // GtkAdjustment* gtk_range_get_adjustment (GtkRange *range);
226 return new Adjustment( gtk_range_get_adjustment(gtkRange) );
230 * Sets the update policy for the range. GTK_UPDATE_CONTINUOUS means that
231 * anytime the range slider is moved, the range value will change and the
232 * value_changed signal will be emitted. GTK_UPDATE_DELAYED means that
233 * the value will be updated after a brief timeout where no slider motion
234 * occurs, so updates are spaced by a short time rather than
235 * continuous. GTK_UPDATE_DISCONTINUOUS means that the value will only
236 * be updated when the user releases the button and ends the slider
237 * drag operation.
238 * range:
239 * a GtkRange
240 * policy:
241 * update policy
243 public void setUpdatePolicy(GtkUpdateType policy)
245 // void gtk_range_set_update_policy (GtkRange *range, GtkUpdateType policy);
246 gtk_range_set_update_policy(gtkRange, policy);
250 * Sets the adjustment to be used as the "model" object for this range
251 * widget. The adjustment indicates the current range value, the
252 * minimum and maximum range values, the step/page increments used
253 * for keybindings and scrolling, and the page size. The page size
254 * is normally 0 for GtkScale and nonzero for GtkScrollbar, and
255 * indicates the size of the visible area of the widget being scrolled.
256 * The page size affects the size of the scrollbar slider.
257 * range:
258 * a GtkRange
259 * adjustment:
260 * a GtkAdjustment
262 public void setAdjustment(Adjustment adjustment)
264 // void gtk_range_set_adjustment (GtkRange *range, GtkAdjustment *adjustment);
265 gtk_range_set_adjustment(gtkRange, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
269 * Gets the value set by gtk_range_set_inverted().
270 * range:
271 * a GtkRange
272 * Returns:
273 * TRUE if the range is inverted
275 public int getInverted()
277 // gboolean gtk_range_get_inverted (GtkRange *range);
278 return gtk_range_get_inverted(gtkRange);
282 * Ranges normally move from lower to higher values as the
283 * slider moves from top to bottom or left to right. Inverted
284 * ranges have higher values at the top or on the right rather than
285 * on the bottom or left.
286 * range:
287 * a GtkRange
288 * setting:
289 * TRUE to invert the range
291 public void setInverted(int setting)
293 // void gtk_range_set_inverted (GtkRange *range, gboolean setting);
294 gtk_range_set_inverted(gtkRange, setting);
298 * Gets the update policy of range. See gtk_range_set_update_policy().
299 * range:
300 * a GtkRange
301 * Returns:
302 * the current update policy
304 public GtkUpdateType getUpdatePolicy()
306 // GtkUpdateType gtk_range_get_update_policy (GtkRange *range);
307 return gtk_range_get_update_policy(gtkRange);
311 * Gets the current value of the range.
312 * range:
313 * a GtkRange
314 * Returns:
315 * current value of the range.
317 public double getValue()
319 // gdouble gtk_range_get_value (GtkRange *range);
320 return gtk_range_get_value(gtkRange);
324 * Sets the step and page sizes for the range.
325 * The step size is used when the user clicks the GtkScrollbar
326 * arrows or moves GtkScale via arrow keys. The page size
327 * is used for example when moving via Page Up or Page Down keys.
328 * range:
329 * a GtkRange
330 * step:
331 * step size
332 * page:
333 * page size
335 public void setIncrements(double step, double page)
337 // void gtk_range_set_increments (GtkRange *range, gdouble step, gdouble page);
338 gtk_range_set_increments(gtkRange, step, page);
342 * Sets the allowable values in the GtkRange, and clamps the range
343 * value to be between min and max. (If the range has a non-zero
344 * page size, it is clamped between min and max - page-size.)
345 * range:
346 * a GtkRange
347 * min:
348 * minimum range value
349 * max:
350 * maximum range value
352 public void setRange(double min, double max)
354 // void gtk_range_set_range (GtkRange *range, gdouble min, gdouble max);
355 gtk_range_set_range(gtkRange, min, max);
359 * Sets the current value of the range; if the value is outside the
360 * minimum or maximum range values, it will be clamped to fit inside
361 * them. The range emits the "value_changed" signal if the value
362 * changes.
363 * range:
364 * a GtkRange
365 * value:
366 * new value of the range
368 public void setValue(double value)
370 // void gtk_range_set_value (GtkRange *range, gdouble value);
371 gtk_range_set_value(gtkRange, value);
376 * Sets the sensitivity policy for the stepper that points to the
377 * 'lower' end of the GtkRange's adjustment.
378 * range:
379 * a GtkRange
380 * sensitivity:
381 * the lower stepper's sensitivity policy.
382 * Since 2.10
384 public void setLowerStepperSensitivity(GtkSensitivityType sensitivity)
386 // void gtk_range_set_lower_stepper_sensitivity (GtkRange *range, GtkSensitivityType sensitivity);
387 gtk_range_set_lower_stepper_sensitivity(gtkRange, sensitivity);
391 * Gets the sensitivity policy for the stepper that points to the
392 * 'lower' end of the GtkRange's adjustment.
393 * range:
394 * a GtkRange
395 * Returns:
396 * The lower stepper's sensitivity policy.
397 * Since 2.10
399 public GtkSensitivityType getLowerStepperSensitivity()
401 // GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange *range);
402 return gtk_range_get_lower_stepper_sensitivity(gtkRange);
406 * Sets the sensitivity policy for the stepper that points to the
407 * 'upper' end of the GtkRange's adjustment.
408 * range:
409 * a GtkRange
410 * sensitivity:
411 * the upper stepper's sensitivity policy.
412 * Since 2.10
414 public void setUpperStepperSensitivity(GtkSensitivityType sensitivity)
416 // void gtk_range_set_upper_stepper_sensitivity (GtkRange *range, GtkSensitivityType sensitivity);
417 gtk_range_set_upper_stepper_sensitivity(gtkRange, sensitivity);
421 * Gets the sensitivity policy for the stepper that points to the
422 * 'upper' end of the GtkRange's adjustment.
423 * range:
424 * a GtkRange
425 * Returns:
426 * The upper stepper's sensitivity policy.
427 * Since 2.10
428 * Property Details
429 * The "adjustment" property
430 * "adjustment" GtkAdjustment : Read / Write / Construct
431 * The GtkAdjustment that contains the current value of this range object.
433 public GtkSensitivityType getUpperStepperSensitivity()
435 // GtkSensitivityType gtk_range_get_upper_stepper_sensitivity (GtkRange *range);
436 return gtk_range_get_upper_stepper_sensitivity(gtkRange);