alternative to assert
[gtkD.git] / gtkD / src / gtk / Range.d
blobc2a1ae73e0229485940d721da384b8abc2c45097
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 = 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 * module aliases:
49 * local aliases:
52 module gtk.Range;
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.Widget;
76 public class Range : Widget
79 /** the main Gtk struct */
80 protected GtkRange* gtkRange;
83 public GtkRange* getRangeStruct()
85 return gtkRange;
89 /** the main Gtk struct as a void* */
90 protected void* getStruct()
92 return cast(void*)gtkRange;
95 /**
96 * Sets our main struct and passes it to the parent class
98 public this (GtkRange* gtkRange)
100 version(noAssert)
102 if ( gtkRange is null )
104 int zero = 0;
105 version(Tango)
107 Stdout("struct gtkRange is null on constructor").newline;
109 else
111 printf("struct gtkRange is null on constructor");
113 zero = zero / zero;
116 else
118 assert(gtkRange !is null, "struct gtkRange is null on constructor");
120 super(cast(GtkWidget*)gtkRange);
121 this.gtkRange = gtkRange;
127 // imports for the signal processing
128 private import gobject.Signals;
129 private import gtkc.gdktypes;
130 int[char[]] connectedSignals;
132 void delegate(gdouble, Range)[] onAdjustBoundsListeners;
133 void addOnAdjustBounds(void delegate(gdouble, Range) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
135 if ( !("adjust-bounds" in connectedSignals) )
137 Signals.connectData(
138 getStruct(),
139 "adjust-bounds",
140 cast(GCallback)&callBackAdjustBounds,
141 cast(void*)this,
142 null,
143 connectFlags);
144 connectedSignals["adjust-bounds"] = 1;
146 onAdjustBoundsListeners ~= dlg;
148 extern(C) static void callBackAdjustBounds(GtkRange* rangeStruct, gdouble arg1, Range range)
150 bool consumed = false;
152 foreach ( void delegate(gdouble, Range) dlg ; range.onAdjustBoundsListeners )
154 dlg(arg1, range);
157 return consumed;
160 gboolean delegate(GtkScrollType, gdouble, Range)[] onChangeValueListeners;
161 void addOnChangeValue(gboolean delegate(GtkScrollType, gdouble, Range) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
163 if ( !("change-value" in connectedSignals) )
165 Signals.connectData(
166 getStruct(),
167 "change-value",
168 cast(GCallback)&callBackChangeValue,
169 cast(void*)this,
170 null,
171 connectFlags);
172 connectedSignals["change-value"] = 1;
174 onChangeValueListeners ~= dlg;
176 extern(C) static void callBackChangeValue(GtkRange* rangeStruct, GtkScrollType scroll, gdouble value, Range range)
178 bool consumed = false;
180 foreach ( gboolean delegate(GtkScrollType, gdouble, Range) dlg ; range.onChangeValueListeners )
182 dlg(scroll, value, range);
185 return consumed;
188 void delegate(GtkScrollType, Range)[] onMoveSliderListeners;
189 void addOnMoveSlider(void delegate(GtkScrollType, Range) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
191 if ( !("move-slider" in connectedSignals) )
193 Signals.connectData(
194 getStruct(),
195 "move-slider",
196 cast(GCallback)&callBackMoveSlider,
197 cast(void*)this,
198 null,
199 connectFlags);
200 connectedSignals["move-slider"] = 1;
202 onMoveSliderListeners ~= dlg;
204 extern(C) static void callBackMoveSlider(GtkRange* rangeStruct, GtkScrollType arg1, Range range)
206 bool consumed = false;
208 foreach ( void delegate(GtkScrollType, Range) dlg ; range.onMoveSliderListeners )
210 dlg(arg1, range);
213 return consumed;
216 void delegate(Range)[] onValueChangedListeners;
217 void addOnValueChanged(void delegate(Range) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
219 if ( !("value-changed" in connectedSignals) )
221 Signals.connectData(
222 getStruct(),
223 "value-changed",
224 cast(GCallback)&callBackValueChanged,
225 cast(void*)this,
226 null,
227 connectFlags);
228 connectedSignals["value-changed"] = 1;
230 onValueChangedListeners ~= dlg;
232 extern(C) static void callBackValueChanged(GtkRange* rangeStruct, Range range)
234 bool consumed = false;
236 foreach ( void delegate(Range) dlg ; range.onValueChangedListeners )
238 dlg(range);
241 return consumed;
247 * range:
248 * A GtkRange
249 * Returns:
250 * The current position of the fill level indicator.
251 * Since 2.12
253 public double getFillLevel()
255 // gdouble gtk_range_get_fill_level (GtkRange *range);
256 return gtk_range_get_fill_level(gtkRange);
260 * range:
261 * A GtkRange
262 * Returns:
263 * Whether GtkRange is restricted to the fill level.
264 * Since 2.12
266 public int getRestrictToFillLevel()
268 // gboolean gtk_range_get_restrict_to_fill_level (GtkRange *range);
269 return gtk_range_get_restrict_to_fill_level(gtkRange);
273 * range:
274 * A GtkRange
275 * Returns:
276 * Whether GtkRange displays a fill level graphics.
277 * Since 2.12
279 public int getShowFillLevel()
281 // gboolean gtk_range_get_show_fill_level (GtkRange *range);
282 return gtk_range_get_show_fill_level(gtkRange);
286 * Set the new position of the fill level indicator.
287 * The "fill level" is probably best described by its most prominent
288 * use case, which is an indicator for the amount of pre-buffering in
289 * a streaming media player. In that use case, the value of the range
290 * would indicate the current play position, and the fill level would
291 * be the position up to which the file/stream has been downloaded.
292 * This amount of prebuffering can be displayed on the range's trough
293 * and is themeable separately from the trough. To enable fill level
294 * display, use gtk_range_set_show_fill_level(). The range defaults
295 * to not showing the fill level.
296 * Additionally, it's possible to restrict the range's slider position
297 * to values which are smaller than the fill level. This is controller
298 * by gtk_range_set_restrict_to_fill_level() and is by default
299 * enabled.
300 * range:
301 * A GtkRange
302 * fill_level:
303 * Since 2.12
305 public void setFillLevel(double fillLevel)
307 // void gtk_range_set_fill_level (GtkRange *range, gdouble fill_level);
308 gtk_range_set_fill_level(gtkRange, fillLevel);
312 * Sets whether the slider is restricted to the fill level. See
313 * gtk_range_set_fill_level() for a general description of the fill
314 * level concept.
315 * range:
316 * A GtkRange
317 * restrict_to_fill_level:
318 * Whether the fill level restricts slider movement.
319 * Since 2.12
321 public void setRestrictToFillLevel(int restrictToFillLevel)
323 // void gtk_range_set_restrict_to_fill_level (GtkRange *range, gboolean restrict_to_fill_level);
324 gtk_range_set_restrict_to_fill_level(gtkRange, restrictToFillLevel);
328 * Sets whether a graphical fill level is show on the trough. See
329 * gtk_range_set_fill_level() for a general description of the fill
330 * level concept.
331 * range:
332 * A GtkRange
333 * show_fill_level:
334 * Whether a fill level indicator graphics is shown.
335 * Since 2.12
337 public void setShowFillLevel(int showFillLevel)
339 // void gtk_range_set_show_fill_level (GtkRange *range, gboolean show_fill_level);
340 gtk_range_set_show_fill_level(gtkRange, showFillLevel);
344 * Get the GtkAdjustment which is the "model" object for GtkRange.
345 * See gtk_range_set_adjustment() for details.
346 * The return value does not have a reference added, so should not
347 * be unreferenced.
348 * range:
349 * a GtkRange
350 * Returns:
351 * a GtkAdjustment
353 public Adjustment getAdjustment()
355 // GtkAdjustment* gtk_range_get_adjustment (GtkRange *range);
356 return new Adjustment( gtk_range_get_adjustment(gtkRange) );
360 * Sets the update policy for the range. GTK_UPDATE_CONTINUOUS means that
361 * anytime the range slider is moved, the range value will change and the
362 * value_changed signal will be emitted. GTK_UPDATE_DELAYED means that
363 * the value will be updated after a brief timeout where no slider motion
364 * occurs, so updates are spaced by a short time rather than
365 * continuous. GTK_UPDATE_DISCONTINUOUS means that the value will only
366 * be updated when the user releases the button and ends the slider
367 * drag operation.
368 * range:
369 * a GtkRange
370 * policy:
371 * update policy
373 public void setUpdatePolicy(GtkUpdateType policy)
375 // void gtk_range_set_update_policy (GtkRange *range, GtkUpdateType policy);
376 gtk_range_set_update_policy(gtkRange, policy);
380 * Sets the adjustment to be used as the "model" object for this range
381 * widget. The adjustment indicates the current range value, the
382 * minimum and maximum range values, the step/page increments used
383 * for keybindings and scrolling, and the page size. The page size
384 * is normally 0 for GtkScale and nonzero for GtkScrollbar, and
385 * indicates the size of the visible area of the widget being scrolled.
386 * The page size affects the size of the scrollbar slider.
387 * range:
388 * a GtkRange
389 * adjustment:
390 * a GtkAdjustment
392 public void setAdjustment(Adjustment adjustment)
394 // void gtk_range_set_adjustment (GtkRange *range, GtkAdjustment *adjustment);
395 gtk_range_set_adjustment(gtkRange, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
399 * Gets the value set by gtk_range_set_inverted().
400 * range:
401 * a GtkRange
402 * Returns:
403 * TRUE if the range is inverted
405 public int getInverted()
407 // gboolean gtk_range_get_inverted (GtkRange *range);
408 return gtk_range_get_inverted(gtkRange);
412 * Ranges normally move from lower to higher values as the
413 * slider moves from top to bottom or left to right. Inverted
414 * ranges have higher values at the top or on the right rather than
415 * on the bottom or left.
416 * range:
417 * a GtkRange
418 * setting:
419 * TRUE to invert the range
421 public void setInverted(int setting)
423 // void gtk_range_set_inverted (GtkRange *range, gboolean setting);
424 gtk_range_set_inverted(gtkRange, setting);
428 * Gets the update policy of range. See gtk_range_set_update_policy().
429 * range:
430 * a GtkRange
431 * Returns:
432 * the current update policy
434 public GtkUpdateType getUpdatePolicy()
436 // GtkUpdateType gtk_range_get_update_policy (GtkRange *range);
437 return gtk_range_get_update_policy(gtkRange);
441 * Gets the current value of the range.
442 * range:
443 * a GtkRange
444 * Returns:
445 * current value of the range.
447 public double getValue()
449 // gdouble gtk_range_get_value (GtkRange *range);
450 return gtk_range_get_value(gtkRange);
454 * Sets the step and page sizes for the range.
455 * The step size is used when the user clicks the GtkScrollbar
456 * arrows or moves GtkScale via arrow keys. The page size
457 * is used for example when moving via Page Up or Page Down keys.
458 * range:
459 * a GtkRange
460 * step:
461 * step size
462 * page:
463 * page size
465 public void setIncrements(double step, double page)
467 // void gtk_range_set_increments (GtkRange *range, gdouble step, gdouble page);
468 gtk_range_set_increments(gtkRange, step, page);
472 * Sets the allowable values in the GtkRange, and clamps the range
473 * value to be between min and max. (If the range has a non-zero
474 * page size, it is clamped between min and max - page-size.)
475 * range:
476 * a GtkRange
477 * min:
478 * minimum range value
479 * max:
480 * maximum range value
482 public void setRange(double min, double max)
484 // void gtk_range_set_range (GtkRange *range, gdouble min, gdouble max);
485 gtk_range_set_range(gtkRange, min, max);
489 * Sets the current value of the range; if the value is outside the
490 * minimum or maximum range values, it will be clamped to fit inside
491 * them. The range emits the "value_changed" signal if the value
492 * changes.
493 * range:
494 * a GtkRange
495 * value:
496 * new value of the range
498 public void setValue(double value)
500 // void gtk_range_set_value (GtkRange *range, gdouble value);
501 gtk_range_set_value(gtkRange, value);
506 * Sets the sensitivity policy for the stepper that points to the
507 * 'lower' end of the GtkRange's adjustment.
508 * range:
509 * a GtkRange
510 * sensitivity:
511 * the lower stepper's sensitivity policy.
512 * Since 2.10
514 public void setLowerStepperSensitivity(GtkSensitivityType sensitivity)
516 // void gtk_range_set_lower_stepper_sensitivity (GtkRange *range, GtkSensitivityType sensitivity);
517 gtk_range_set_lower_stepper_sensitivity(gtkRange, sensitivity);
521 * Gets the sensitivity policy for the stepper that points to the
522 * 'lower' end of the GtkRange's adjustment.
523 * range:
524 * a GtkRange
525 * Returns:
526 * The lower stepper's sensitivity policy.
527 * Since 2.10
529 public GtkSensitivityType getLowerStepperSensitivity()
531 // GtkSensitivityType gtk_range_get_lower_stepper_sensitivity (GtkRange *range);
532 return gtk_range_get_lower_stepper_sensitivity(gtkRange);
536 * Sets the sensitivity policy for the stepper that points to the
537 * 'upper' end of the GtkRange's adjustment.
538 * range:
539 * a GtkRange
540 * sensitivity:
541 * the upper stepper's sensitivity policy.
542 * Since 2.10
544 public void setUpperStepperSensitivity(GtkSensitivityType sensitivity)
546 // void gtk_range_set_upper_stepper_sensitivity (GtkRange *range, GtkSensitivityType sensitivity);
547 gtk_range_set_upper_stepper_sensitivity(gtkRange, sensitivity);
551 * Gets the sensitivity policy for the stepper that points to the
552 * 'upper' end of the GtkRange's adjustment.
553 * range:
554 * a GtkRange
555 * Returns:
556 * The upper stepper's sensitivity policy.
557 * Since 2.10
558 * Property Details
559 * The "adjustment" property
560 * "adjustment" GtkAdjustment : Read / Write / Construct
561 * The GtkAdjustment that contains the current value of this range object.
563 public GtkSensitivityType getUpperStepperSensitivity()
565 // GtkSensitivityType gtk_range_get_upper_stepper_sensitivity (GtkRange *range);
566 return gtk_range_get_upper_stepper_sensitivity(gtkRange);