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