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