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 = GtkScaleButton.html 27 * outPack = gtk 28 * outFile = ScaleButton 29 * strct = GtkScaleButton 30 * realStrct= 31 * ctorStrct= 32 * clss = ScaleButton 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - OrientableIF 40 * prefixes: 41 * - gtk_scale_button_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * - gtk_scale_button_set_orientation 46 * - gtk_scale_button_get_orientation 47 * omit signals: 48 * imports: 49 * - glib.Str 50 * - gtk.Adjustment 51 * - gtk.Widget 52 * - gtk.OrientableIF 53 * - gtk.OrientableT 54 * structWrap: 55 * - GtkAdjustment* -> Adjustment 56 * - GtkWidget* -> Widget 57 * module aliases: 58 * local aliases: 59 * overrides: 60 */ 61 62 module gtk.ScaleButton; 63 64 public import gtkc.gtktypes; 65 66 private import gtkc.gtk; 67 private import glib.ConstructionException; 68 private import gobject.ObjectG; 69 70 private import gobject.Signals; 71 public import gtkc.gdktypes; 72 73 private import glib.Str; 74 private import gtk.Adjustment; 75 private import gtk.Widget; 76 private import gtk.OrientableIF; 77 private import gtk.OrientableT; 78 79 80 81 private import gtk.Button; 82 83 /** 84 * GtkScaleButton provides a button which pops up a scale widget. 85 * This kind of widget is commonly used for volume controls in multimedia 86 * applications, and GTK+ provides a GtkVolumeButton subclass that 87 * is tailored for this use case. 88 */ 89 public class ScaleButton : Button, OrientableIF 90 { 91 92 /** the main Gtk struct */ 93 protected GtkScaleButton* gtkScaleButton; 94 95 96 public GtkScaleButton* getScaleButtonStruct() 97 { 98 return gtkScaleButton; 99 } 100 101 102 /** the main Gtk struct as a void* */ 103 protected override void* getStruct() 104 { 105 return cast(void*)gtkScaleButton; 106 } 107 108 /** 109 * Sets our main struct and passes it to the parent class 110 */ 111 public this (GtkScaleButton* gtkScaleButton) 112 { 113 super(cast(GtkButton*)gtkScaleButton); 114 this.gtkScaleButton = gtkScaleButton; 115 } 116 117 protected override void setStruct(GObject* obj) 118 { 119 super.setStruct(obj); 120 gtkScaleButton = cast(GtkScaleButton*)obj; 121 } 122 123 // add the Orientable capabilities 124 mixin OrientableT!(GtkScaleButton); 125 126 /** 127 */ 128 int[string] connectedSignals; 129 130 void delegate(ScaleButton)[] onPopdownListeners; 131 /** 132 * The ::popdown signal is a 133 * keybinding signal 134 * which gets emitted to popdown the scale widget. 135 * The default binding for this signal is Escape. 136 * Since 2.12 137 */ 138 void addOnPopdown(void delegate(ScaleButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 139 { 140 if ( !("popdown" in connectedSignals) ) 141 { 142 Signals.connectData( 143 getStruct(), 144 "popdown", 145 cast(GCallback)&callBackPopdown, 146 cast(void*)this, 147 null, 148 connectFlags); 149 connectedSignals["popdown"] = 1; 150 } 151 onPopdownListeners ~= dlg; 152 } 153 extern(C) static void callBackPopdown(GtkScaleButton* buttonStruct, ScaleButton _scaleButton) 154 { 155 foreach ( void delegate(ScaleButton) dlg ; _scaleButton.onPopdownListeners ) 156 { 157 dlg(_scaleButton); 158 } 159 } 160 161 void delegate(ScaleButton)[] onPopupListeners; 162 /** 163 * The ::popup signal is a 164 * keybinding signal 165 * which gets emitted to popup the scale widget. 166 * The default bindings for this signal are Space, Enter and Return. 167 * Since 2.12 168 */ 169 void addOnPopup(void delegate(ScaleButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 170 { 171 if ( !("popup" in connectedSignals) ) 172 { 173 Signals.connectData( 174 getStruct(), 175 "popup", 176 cast(GCallback)&callBackPopup, 177 cast(void*)this, 178 null, 179 connectFlags); 180 connectedSignals["popup"] = 1; 181 } 182 onPopupListeners ~= dlg; 183 } 184 extern(C) static void callBackPopup(GtkScaleButton* buttonStruct, ScaleButton _scaleButton) 185 { 186 foreach ( void delegate(ScaleButton) dlg ; _scaleButton.onPopupListeners ) 187 { 188 dlg(_scaleButton); 189 } 190 } 191 192 void delegate(gdouble, ScaleButton)[] onValueChangedListeners; 193 /** 194 * The ::value-changed signal is emitted when the value field has 195 * changed. 196 * Since 2.12 197 */ 198 void addOnValueChanged(void delegate(gdouble, ScaleButton) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 199 { 200 if ( !("value-changed" in connectedSignals) ) 201 { 202 Signals.connectData( 203 getStruct(), 204 "value-changed", 205 cast(GCallback)&callBackValueChanged, 206 cast(void*)this, 207 null, 208 connectFlags); 209 connectedSignals["value-changed"] = 1; 210 } 211 onValueChangedListeners ~= dlg; 212 } 213 extern(C) static void callBackValueChanged(GtkScaleButton* buttonStruct, gdouble value, ScaleButton _scaleButton) 214 { 215 foreach ( void delegate(gdouble, ScaleButton) dlg ; _scaleButton.onValueChangedListeners ) 216 { 217 dlg(value, _scaleButton); 218 } 219 } 220 221 222 /** 223 * Creates a GtkScaleButton, with a range between min and max, with 224 * a stepping of step. 225 * Since 2.12 226 * Params: 227 * size = a stock icon size. [type int] 228 * min = the minimum value of the scale (usually 0) 229 * max = the maximum value of the scale (usually 100) 230 * step = the stepping of value when a scroll-wheel event, 231 * or up/down arrow event occurs (usually 2) 232 * icons = a NULL-terminated 233 * array of icon names, or NULL if you want to set the list 234 * later with gtk_scale_button_set_icons(). [allow-none][array zero-terminated=1] 235 * Throws: ConstructionException GTK+ fails to create the object. 236 */ 237 public this (GtkIconSize size, double min, double max, double step, string[] icons) 238 { 239 // GtkWidget * gtk_scale_button_new (GtkIconSize size, gdouble min, gdouble max, gdouble step, const gchar **icons); 240 auto p = gtk_scale_button_new(size, min, max, step, Str.toStringzArray(icons)); 241 if(p is null) 242 { 243 throw new ConstructionException("null returned by gtk_scale_button_new(size, min, max, step, Str.toStringzArray(icons))"); 244 } 245 this(cast(GtkScaleButton*) p); 246 } 247 248 /** 249 * Sets the GtkAdjustment to be used as a model 250 * for the GtkScaleButton's scale. 251 * See gtk_range_set_adjustment() for details. 252 * Since 2.12 253 * Params: 254 * adjustment = a GtkAdjustment 255 */ 256 public void setAdjustment(Adjustment adjustment) 257 { 258 // void gtk_scale_button_set_adjustment (GtkScaleButton *button, GtkAdjustment *adjustment); 259 gtk_scale_button_set_adjustment(gtkScaleButton, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 260 } 261 262 /** 263 * Sets the icons to be used by the scale button. 264 * For details, see the "icons" property. 265 * Since 2.12 266 * Params: 267 * icons = a NULL-terminated array of icon names. [array zero-terminated=1] 268 */ 269 public void setIcons(string[] icons) 270 { 271 // void gtk_scale_button_set_icons (GtkScaleButton *button, const gchar **icons); 272 gtk_scale_button_set_icons(gtkScaleButton, Str.toStringzArray(icons)); 273 } 274 275 /** 276 * Sets the current value of the scale; if the value is outside 277 * the minimum or maximum range values, it will be clamped to fit 278 * inside them. The scale button emits the "value-changed" 279 * signal if the value changes. 280 * Since 2.12 281 * Params: 282 * value = new value of the scale button 283 */ 284 public void setValue(double value) 285 { 286 // void gtk_scale_button_set_value (GtkScaleButton *button, gdouble value); 287 gtk_scale_button_set_value(gtkScaleButton, value); 288 } 289 290 /** 291 * Gets the GtkAdjustment associated with the GtkScaleButton's scale. 292 * See gtk_range_get_adjustment() for details. 293 * Since 2.12 294 * Returns: the adjustment associated with the scale. [transfer none] 295 */ 296 public Adjustment getAdjustment() 297 { 298 // GtkAdjustment * gtk_scale_button_get_adjustment (GtkScaleButton *button); 299 auto p = gtk_scale_button_get_adjustment(gtkScaleButton); 300 301 if(p is null) 302 { 303 return null; 304 } 305 306 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 307 } 308 309 /** 310 * Gets the current value of the scale button. 311 * Since 2.12 312 * Returns: current value of the scale button 313 */ 314 public double getValue() 315 { 316 // gdouble gtk_scale_button_get_value (GtkScaleButton *button); 317 return gtk_scale_button_get_value(gtkScaleButton); 318 } 319 320 /** 321 * Retrieves the popup of the GtkScaleButton. 322 * Since 2.14 323 * Returns: the popup of the GtkScaleButton. [transfer none] 324 */ 325 public Widget getPopup() 326 { 327 // GtkWidget * gtk_scale_button_get_popup (GtkScaleButton *button); 328 auto p = gtk_scale_button_get_popup(gtkScaleButton); 329 330 if(p is null) 331 { 332 return null; 333 } 334 335 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 336 } 337 338 /** 339 * Retrieves the plus button of the GtkScaleButton. 340 * Since 2.14 341 * Returns: the plus button of the GtkScaleButton. [transfer none] 342 */ 343 public Widget getPlusButton() 344 { 345 // GtkWidget * gtk_scale_button_get_plus_button (GtkScaleButton *button); 346 auto p = gtk_scale_button_get_plus_button(gtkScaleButton); 347 348 if(p is null) 349 { 350 return null; 351 } 352 353 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 354 } 355 356 /** 357 * Retrieves the minus button of the GtkScaleButton. 358 * Since 2.14 359 * Returns: the minus button of the GtkScaleButton. [transfer none] 360 */ 361 public Widget getMinusButton() 362 { 363 // GtkWidget * gtk_scale_button_get_minus_button (GtkScaleButton *button); 364 auto p = gtk_scale_button_get_minus_button(gtkScaleButton); 365 366 if(p is null) 367 { 368 return null; 369 } 370 371 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 372 } 373 }