1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkHScale.html 27 * outPack = gtk 28 * outFile = HScale 29 * strct = GtkHScale 30 * realStrct= 31 * ctorStrct= 32 * clss = HScale 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_hscale_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gtk.Adjustment 48 * structWrap: 49 * - GtkAdjustment* -> Adjustment 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gtk.HScale; 56 57 public import gtkc.gtktypes; 58 59 private import gtkc.gtk; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import gtk.Adjustment; 65 66 67 68 private import gtk.Scale; 69 70 /** 71 * Description 72 * The GtkHScale widget is used to allow the user to select a value using 73 * a horizontal slider. To create one, use gtk_hscale_new_with_range(). 74 * The position to show the current value, and the number of decimal places 75 * shown can be set using the parent GtkScale class's functions. 76 */ 77 public class HScale : Scale 78 { 79 80 /** the main Gtk struct */ 81 protected GtkHScale* gtkHScale; 82 83 84 public GtkHScale* getHScaleStruct() 85 { 86 return gtkHScale; 87 } 88 89 90 /** the main Gtk struct as a void* */ 91 protected override void* getStruct() 92 { 93 return cast(void*)gtkHScale; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class 98 */ 99 public this (GtkHScale* gtkHScale) 100 { 101 super(cast(GtkScale*)gtkHScale); 102 this.gtkHScale = gtkHScale; 103 } 104 105 protected override void setStruct(GObject* obj) 106 { 107 super.setStruct(obj); 108 gtkHScale = cast(GtkHScale*)obj; 109 } 110 111 /** 112 */ 113 114 /** 115 * Creates a new GtkHScale. 116 * Params: 117 * adjustment = the GtkAdjustment which sets the range of the scale. 118 * Throws: ConstructionException GTK+ fails to create the object. 119 */ 120 public this (Adjustment adjustment) 121 { 122 // GtkWidget * gtk_hscale_new (GtkAdjustment *adjustment); 123 auto p = gtk_hscale_new((adjustment is null) ? null : adjustment.getAdjustmentStruct()); 124 if(p is null) 125 { 126 throw new ConstructionException("null returned by gtk_hscale_new((adjustment is null) ? null : adjustment.getAdjustmentStruct())"); 127 } 128 this(cast(GtkHScale*) p); 129 } 130 131 /** 132 * Creates a new horizontal scale widget that lets the user input a 133 * number between min and max (including min and max) with the 134 * increment step. step must be nonzero; it's the distance the 135 * slider moves when using the arrow keys to adjust the scale value. 136 * Note that the way in which the precision is derived works best if step 137 * is a power of ten. If the resulting precision is not suitable for your 138 * needs, use gtk_scale_set_digits() to correct it. 139 * Params: 140 * min = minimum value 141 * max = maximum value 142 * step = step increment (tick size) used with keyboard shortcuts 143 * Throws: ConstructionException GTK+ fails to create the object. 144 */ 145 public this (double min, double max, double step) 146 { 147 // GtkWidget * gtk_hscale_new_with_range (gdouble min, gdouble max, gdouble step); 148 auto p = gtk_hscale_new_with_range(min, max, step); 149 if(p is null) 150 { 151 throw new ConstructionException("null returned by gtk_hscale_new_with_range(min, max, step)"); 152 } 153 this(cast(GtkHScale*) p); 154 } 155 }