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  = GtkButton.html
27  * outPack = gtk
28  * outFile = Button
29  * strct   = GtkButton
30  * realStrct=
31  * ctorStrct=
32  * clss    = Button
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- ActionableIF
40  * 	- ActivatableIF
41  * prefixes:
42  * 	- gtk_button_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * 	- gtk_button_new_with_mnemonic
47  * 	- gtk_button_new_with_label
48  * 	- gtk_button_new_from_stock
49  * omit signals:
50  * imports:
51  * 	- glib.Str
52  * 	- gtk.Image
53  * 	- gdk.Window
54  * 	- gtk.Widget
55  * 	- gtk.ActionableIF
56  * 	- gtk.ActionableT
57  * 	- gtk.ActivatableT
58  * 	- gtk.ActivatableIF
59  * structWrap:
60  * 	- GdkWindow* -> Window
61  * 	- GtkWidget* -> Widget
62  * module aliases:
63  * local aliases:
64  * overrides:
65  */
66 
67 module gtk.Button;
68 
69 public  import gtkc.gtktypes;
70 
71 private import gtkc.gtk;
72 private import glib.ConstructionException;
73 private import gobject.ObjectG;
74 
75 private import gobject.Signals;
76 public  import gtkc.gdktypes;
77 private import glib.Str;
78 private import gtk.Image;
79 private import gdk.Window;
80 private import gtk.Widget;
81 private import gtk.ActionableIF;
82 private import gtk.ActionableT;
83 private import gtk.ActivatableT;
84 private import gtk.ActivatableIF;
85 
86 
87 private import gtk.Bin;
88 
89 /**
90  * The GtkButton widget is generally used to trigger a callback function that is
91  * called when the button is pressed. The various signals and how to use them
92  * are outlined below.
93  *
94  * The GtkButton widget can hold any valid child widget. That is, it can hold
95  * almost any other standard GtkWidget. The most commonly used child is the
96  * GtkLabel.
97  */
98 public class Button : Bin, ActionableIF, ActivatableIF
99 {
100 	
101 	/** the main Gtk struct */
102 	protected GtkButton* gtkButton;
103 	
104 	
105 	/** Get the main Gtk struct */
106 	public GtkButton* getButtonStruct()
107 	{
108 		return gtkButton;
109 	}
110 	
111 	
112 	/** the main Gtk struct as a void* */
113 	protected override void* getStruct()
114 	{
115 		return cast(void*)gtkButton;
116 	}
117 	
118 	/**
119 	 * Sets our main struct and passes it to the parent class
120 	 */
121 	public this (GtkButton* gtkButton)
122 	{
123 		super(cast(GtkBin*)gtkButton);
124 		this.gtkButton = gtkButton;
125 	}
126 	
127 	protected override void setStruct(GObject* obj)
128 	{
129 		super.setStruct(obj);
130 		gtkButton = cast(GtkButton*)obj;
131 	}
132 	
133 	private static IconSize currentIconSize = IconSize.BUTTON;
134 	
135 	// add the Actionable capabilities
136 	mixin ActionableT!(GtkButton);
137 	
138 	// add the Activatable capabilities
139 	mixin ActivatableT!(GtkButton);
140 	
141 	/** */
142 	public static void setIconSize(IconSize iconSize)
143 	{
144 		currentIconSize = iconSize;
145 	}
146 	
147 	/** */
148 	public static IconSize getIconSize()
149 	{
150 		return currentIconSize;
151 	}
152 	
153 	/**
154 	 * Creates a new GtkButton containing a label.
155 	 * If characters in label are preceded by an underscore, they are underlined.
156 	 * If you need a literal underscore character in a label, use '__' (two
157 	 * underscores). The first underlined character represents a keyboard
158 	 * accelerator called a mnemonic.
159 	 * Pressing Alt and that key activates the button.
160 	 * Params:
161 	 *  label = The text of the button, with an underscore in front of the
162 	 *  mnemonic character
163 	 *  mnemonic = true if the button has an mnemnonic
164 	 * Returns:
165 	 *  a new GtkButton
166 	 * Throws: ConstructionException GTK+ fails to create the object.
167 	 */
168 	public this (string label, bool mnemonic=true)
169 	{
170 		GtkButton* p;
171 		
172 		if ( mnemonic )
173 		{
174 			// GtkWidget* gtk_button_new_with_mnemonic (const gchar *label);
175 			p = cast(GtkButton*)gtk_button_new_with_mnemonic(Str.toStringz(label));
176 		}
177 		else
178 		{
179 			// GtkWidget* gtk_button_new_with_label (const gchar *label);
180 			p = cast(GtkButton*)gtk_button_new_with_label(Str.toStringz(label));
181 		}
182 		
183 		if(p is null)
184 		{
185 			throw new ConstructionException("null returned by gtk_button_new_with_label");
186 		}
187 		
188 		this(p);
189 	}
190 	
191 	/**
192 	 * Creates a new GtkButton containing the image and text from a stock item.
193 	 * Some stock ids have preprocessor macros like GTK_STOCK_OK and
194 	 * GTK_STOCK_APPLY.
195 	 * If stock_id is unknown, then it will be treated as a mnemonic
196 	 * label (as for gtk_button_new_with_mnemonic()).
197 	 * Params:
198 	 *  StockID = the name of the stock item
199 	 * Throws: ConstructionException GTK+ fails to create the object.
200 	 */
201 	public this (StockID stockID, bool hideLabel=false)
202 	{
203 		// GtkWidget* gtk_button_new_from_stock (const gchar *stock_id);
204 		if ( hideLabel )
205 		{
206 			this();
207 			Image image = new Image(stockID,currentIconSize);
208 			add(image);
209 		}
210 		else
211 		{
212 			auto p = gtk_button_new_from_stock(Str.toStringz(StockDesc[stockID]));
213 			
214 			if(p is null)
215 			{
216 				throw new ConstructionException("null returned by gtk_button_new_from_stock");
217 			}
218 			
219 			this(cast(GtkButton*) p);
220 		}
221 	}
222 	
223 	/** */
224 	public this(StockID stockID, void delegate(Button) dlg, bool hideLabel=false)
225 	{
226 		this(stockID, hideLabel);
227 		addOnClicked(dlg);
228 	}
229 	
230 	/** */
231 	public this(string label, void delegate(Button) dlg, bool mnemonic=true)
232 	{
233 		this(label, mnemonic);
234 		addOnClicked(dlg);
235 	}
236 	
237 	/** */
238 	public this(string label, void delegate(Button) dlg, string action)
239 	{
240 		this(label);
241 		setActionName(action);
242 		addOnClicked(dlg);
243 	}
244 	
245 	/**
246 	 */
247 	int[string] connectedSignals;
248 	
249 	void delegate(Button)[] onActivateListeners;
250 	/**
251 	 * The ::activate signal on GtkButton is an action signal and
252 	 * emitting it causes the button to animate press then release.
253 	 * Applications should never connect to this signal, but use the
254 	 * "clicked" signal.
255 	 */
256 	void addOnActivate(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
257 	{
258 		if ( !("activate" in connectedSignals) )
259 		{
260 			Signals.connectData(
261 			getStruct(),
262 			"activate",
263 			cast(GCallback)&callBackActivate,
264 			cast(void*)this,
265 			null,
266 			connectFlags);
267 			connectedSignals["activate"] = 1;
268 		}
269 		onActivateListeners ~= dlg;
270 	}
271 	extern(C) static void callBackActivate(GtkButton* widgetStruct, Button _button)
272 	{
273 		foreach ( void delegate(Button) dlg ; _button.onActivateListeners )
274 		{
275 			dlg(_button);
276 		}
277 	}
278 	
279 	void delegate(Button)[] onClickedListeners;
280 	/**
281 	 * Emitted when the button has been activated (pressed and released).
282 	 */
283 	void addOnClicked(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
284 	{
285 		if ( !("clicked" in connectedSignals) )
286 		{
287 			Signals.connectData(
288 			getStruct(),
289 			"clicked",
290 			cast(GCallback)&callBackClicked,
291 			cast(void*)this,
292 			null,
293 			connectFlags);
294 			connectedSignals["clicked"] = 1;
295 		}
296 		onClickedListeners ~= dlg;
297 	}
298 	extern(C) static void callBackClicked(GtkButton* buttonStruct, Button _button)
299 	{
300 		foreach ( void delegate(Button) dlg ; _button.onClickedListeners )
301 		{
302 			dlg(_button);
303 		}
304 	}
305 	
306 	void delegate(Button)[] onEnterListeners;
307 	/**
308 	 * Warning
309 	 * GtkButton::enter has been deprecated since version 2.8 and should not be used in newly-written code. Use the "enter-notify-event" signal.
310 	 * Emitted when the pointer enters the button.
311 	 */
312 	void addOnEnter(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
313 	{
314 		if ( !("enter" in connectedSignals) )
315 		{
316 			Signals.connectData(
317 			getStruct(),
318 			"enter",
319 			cast(GCallback)&callBackEnter,
320 			cast(void*)this,
321 			null,
322 			connectFlags);
323 			connectedSignals["enter"] = 1;
324 		}
325 		onEnterListeners ~= dlg;
326 	}
327 	extern(C) static void callBackEnter(GtkButton* buttonStruct, Button _button)
328 	{
329 		foreach ( void delegate(Button) dlg ; _button.onEnterListeners )
330 		{
331 			dlg(_button);
332 		}
333 	}
334 	
335 	void delegate(Button)[] onLeaveListeners;
336 	/**
337 	 * Warning
338 	 * GtkButton::leave has been deprecated since version 2.8 and should not be used in newly-written code. Use the "leave-notify-event" signal.
339 	 * Emitted when the pointer leaves the button.
340 	 */
341 	void addOnLeave(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
342 	{
343 		if ( !("leave" in connectedSignals) )
344 		{
345 			Signals.connectData(
346 			getStruct(),
347 			"leave",
348 			cast(GCallback)&callBackLeave,
349 			cast(void*)this,
350 			null,
351 			connectFlags);
352 			connectedSignals["leave"] = 1;
353 		}
354 		onLeaveListeners ~= dlg;
355 	}
356 	extern(C) static void callBackLeave(GtkButton* buttonStruct, Button _button)
357 	{
358 		foreach ( void delegate(Button) dlg ; _button.onLeaveListeners )
359 		{
360 			dlg(_button);
361 		}
362 	}
363 	
364 	void delegate(Button)[] onPressedListeners;
365 	/**
366 	 * Warning
367 	 * GtkButton::pressed has been deprecated since version 2.8 and should not be used in newly-written code. Use the "button-press-event" signal.
368 	 * Emitted when the button is pressed.
369 	 */
370 	void addOnPressed(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
371 	{
372 		if ( !("pressed" in connectedSignals) )
373 		{
374 			Signals.connectData(
375 			getStruct(),
376 			"pressed",
377 			cast(GCallback)&callBackPressed,
378 			cast(void*)this,
379 			null,
380 			connectFlags);
381 			connectedSignals["pressed"] = 1;
382 		}
383 		onPressedListeners ~= dlg;
384 	}
385 	extern(C) static void callBackPressed(GtkButton* buttonStruct, Button _button)
386 	{
387 		foreach ( void delegate(Button) dlg ; _button.onPressedListeners )
388 		{
389 			dlg(_button);
390 		}
391 	}
392 	
393 	void delegate(Button)[] onReleasedListeners;
394 	/**
395 	 * Warning
396 	 * GtkButton::released has been deprecated since version 2.8 and should not be used in newly-written code. Use the "button-release-event" signal.
397 	 * Emitted when the button is released.
398 	 */
399 	void addOnReleased(void delegate(Button) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
400 	{
401 		if ( !("released" in connectedSignals) )
402 		{
403 			Signals.connectData(
404 			getStruct(),
405 			"released",
406 			cast(GCallback)&callBackReleased,
407 			cast(void*)this,
408 			null,
409 			connectFlags);
410 			connectedSignals["released"] = 1;
411 		}
412 		onReleasedListeners ~= dlg;
413 	}
414 	extern(C) static void callBackReleased(GtkButton* buttonStruct, Button _button)
415 	{
416 		foreach ( void delegate(Button) dlg ; _button.onReleasedListeners )
417 		{
418 			dlg(_button);
419 		}
420 	}
421 	
422 	
423 	/**
424 	 * Creates a new GtkButton widget. To add a child widget to the button,
425 	 * use gtk_container_add().
426 	 * Throws: ConstructionException GTK+ fails to create the object.
427 	 */
428 	public this ()
429 	{
430 		// GtkWidget * gtk_button_new (void);
431 		auto p = gtk_button_new();
432 		if(p is null)
433 		{
434 			throw new ConstructionException("null returned by gtk_button_new()");
435 		}
436 		this(cast(GtkButton*) p);
437 	}
438 	
439 	/**
440 	 * Creates a new button containing an icon from the current icon theme.
441 	 * If the icon name isn't known, a "broken image" icon will be
442 	 * displayed instead. If the current icon theme is changed, the icon
443 	 * will be updated appropriately.
444 	 * This function is a convenience wrapper around gtk_button_new() and
445 	 * gtk_button_set_image().
446 	 * Params:
447 	 * iconName = an icon name
448 	 * size = an icon size. [type int]
449 	 * Throws: ConstructionException GTK+ fails to create the object.
450 	 */
451 	public this (string iconName, GtkIconSize size)
452 	{
453 		// GtkWidget * gtk_button_new_from_icon_name (const gchar *icon_name,  GtkIconSize size);
454 		auto p = gtk_button_new_from_icon_name(Str.toStringz(iconName), size);
455 		if(p is null)
456 		{
457 			throw new ConstructionException("null returned by gtk_button_new_from_icon_name(Str.toStringz(iconName), size)");
458 		}
459 		this(cast(GtkButton*) p);
460 	}
461 	
462 	/**
463 	 * Warning
464 	 * gtk_button_pressed has been deprecated since version 2.20 and should not be used in newly-written code. Use the "button-press-event" signal.
465 	 * Emits a "pressed" signal to the given GtkButton.
466 	 */
467 	public void pressed()
468 	{
469 		// void gtk_button_pressed (GtkButton *button);
470 		gtk_button_pressed(gtkButton);
471 	}
472 	
473 	/**
474 	 * Warning
475 	 * gtk_button_released has been deprecated since version 2.20 and should not be used in newly-written code. Use the "button-release-event" signal.
476 	 * Emits a "released" signal to the given GtkButton.
477 	 */
478 	public void released()
479 	{
480 		// void gtk_button_released (GtkButton *button);
481 		gtk_button_released(gtkButton);
482 	}
483 	
484 	/**
485 	 * Emits a "clicked" signal to the given GtkButton.
486 	 */
487 	public void clicked()
488 	{
489 		// void gtk_button_clicked (GtkButton *button);
490 		gtk_button_clicked(gtkButton);
491 	}
492 	
493 	/**
494 	 * Warning
495 	 * gtk_button_enter has been deprecated since version 2.20 and should not be used in newly-written code. Use the "enter-notify-event" signal.
496 	 * Emits a "enter" signal to the given GtkButton.
497 	 */
498 	public void enter()
499 	{
500 		// void gtk_button_enter (GtkButton *button);
501 		gtk_button_enter(gtkButton);
502 	}
503 	
504 	/**
505 	 * Warning
506 	 * gtk_button_leave has been deprecated since version 2.20 and should not be used in newly-written code. Use the "leave-notify-event" signal.
507 	 * Emits a "leave" signal to the given GtkButton.
508 	 */
509 	public void leave()
510 	{
511 		// void gtk_button_leave (GtkButton *button);
512 		gtk_button_leave(gtkButton);
513 	}
514 	
515 	/**
516 	 * Sets the relief style of the edges of the given GtkButton widget.
517 	 * Three styles exist, GTK_RELIEF_NORMAL, GTK_RELIEF_HALF, GTK_RELIEF_NONE.
518 	 * The default style is, as one can guess, GTK_RELIEF_NORMAL.
519 	 * Params:
520 	 * newstyle = The GtkReliefStyle as described above.
521 	 */
522 	public void setRelief(GtkReliefStyle newstyle)
523 	{
524 		// void gtk_button_set_relief (GtkButton *button,  GtkReliefStyle newstyle);
525 		gtk_button_set_relief(gtkButton, newstyle);
526 	}
527 	
528 	/**
529 	 * Returns the current relief style of the given GtkButton.
530 	 * Returns: The current GtkReliefStyle
531 	 */
532 	public GtkReliefStyle getRelief()
533 	{
534 		// GtkReliefStyle gtk_button_get_relief (GtkButton *button);
535 		return gtk_button_get_relief(gtkButton);
536 	}
537 	
538 	/**
539 	 * Fetches the text from the label of the button, as set by
540 	 * gtk_button_set_label(). If the label text has not
541 	 * been set the return value will be NULL. This will be the
542 	 * case if you create an empty button with gtk_button_new() to
543 	 * use as a container.
544 	 * Returns: The text of the label widget. This string is owned by the widget and must not be modified or freed.
545 	 */
546 	public string getLabel()
547 	{
548 		// const gchar * gtk_button_get_label (GtkButton *button);
549 		return Str.toString(gtk_button_get_label(gtkButton));
550 	}
551 	
552 	/**
553 	 * Sets the text of the label of the button to str. This text is
554 	 * also used to select the stock item if gtk_button_set_use_stock()
555 	 * is used.
556 	 * This will also clear any previously set labels.
557 	 * Params:
558 	 * label = a string
559 	 */
560 	public void setLabel(string label)
561 	{
562 		// void gtk_button_set_label (GtkButton *button,  const gchar *label);
563 		gtk_button_set_label(gtkButton, Str.toStringz(label));
564 	}
565 	
566 	/**
567 	 * Warning
568 	 * gtk_button_get_use_stock is deprecated and should not be used in newly-written code. 3.10
569 	 * Returns whether the button label is a stock item.
570 	 * Returns: TRUE if the button label is used to select a stock item instead of being used directly as the label text.
571 	 */
572 	public int getUseStock()
573 	{
574 		// gboolean gtk_button_get_use_stock (GtkButton *button);
575 		return gtk_button_get_use_stock(gtkButton);
576 	}
577 	
578 	/**
579 	 * Warning
580 	 * gtk_button_set_use_stock is deprecated and should not be used in newly-written code. 3.10
581 	 * If TRUE, the label set on the button is used as a
582 	 * stock id to select the stock item for the button.
583 	 * Params:
584 	 * useStock = TRUE if the button should use a stock item
585 	 */
586 	public void setUseStock(int useStock)
587 	{
588 		// void gtk_button_set_use_stock (GtkButton *button,  gboolean use_stock);
589 		gtk_button_set_use_stock(gtkButton, useStock);
590 	}
591 	
592 	/**
593 	 * Returns whether an embedded underline in the button label indicates a
594 	 * mnemonic. See gtk_button_set_use_underline().
595 	 * Returns: TRUE if an embedded underline in the button label indicates the mnemonic accelerator keys.
596 	 */
597 	public int getUseUnderline()
598 	{
599 		// gboolean gtk_button_get_use_underline (GtkButton *button);
600 		return gtk_button_get_use_underline(gtkButton);
601 	}
602 	
603 	/**
604 	 * If true, an underline in the text of the button label indicates
605 	 * the next character should be used for the mnemonic accelerator key.
606 	 * Params:
607 	 * useUnderline = TRUE if underlines in the text indicate mnemonics
608 	 */
609 	public void setUseUnderline(int useUnderline)
610 	{
611 		// void gtk_button_set_use_underline (GtkButton *button,  gboolean use_underline);
612 		gtk_button_set_use_underline(gtkButton, useUnderline);
613 	}
614 	
615 	/**
616 	 * Sets whether the button will grab focus when it is clicked with the mouse.
617 	 * Making mouse clicks not grab focus is useful in places like toolbars where
618 	 * you don't want the keyboard focus removed from the main area of the
619 	 * application.
620 	 * Since 2.4
621 	 * Params:
622 	 * focusOnClick = whether the button grabs focus when clicked with the mouse
623 	 */
624 	public void setFocusOnClick(int focusOnClick)
625 	{
626 		// void gtk_button_set_focus_on_click (GtkButton *button,  gboolean focus_on_click);
627 		gtk_button_set_focus_on_click(gtkButton, focusOnClick);
628 	}
629 	
630 	/**
631 	 * Returns whether the button grabs focus when it is clicked with the mouse.
632 	 * See gtk_button_set_focus_on_click().
633 	 * Since 2.4
634 	 * Returns: TRUE if the button grabs focus when it is clicked with the mouse.
635 	 */
636 	public int getFocusOnClick()
637 	{
638 		// gboolean gtk_button_get_focus_on_click (GtkButton *button);
639 		return gtk_button_get_focus_on_click(gtkButton);
640 	}
641 	
642 	/**
643 	 * Sets the alignment of the child. This property has no effect unless
644 	 * the child is a GtkMisc or a GtkAlignment.
645 	 * Since 2.4
646 	 * Params:
647 	 * xalign = the horizontal position of the child, 0.0 is left aligned,
648 	 * 1.0 is right aligned
649 	 * yalign = the vertical position of the child, 0.0 is top aligned,
650 	 * 1.0 is bottom aligned
651 	 */
652 	public void setAlignment(float xalign, float yalign)
653 	{
654 		// void gtk_button_set_alignment (GtkButton *button,  gfloat xalign,  gfloat yalign);
655 		gtk_button_set_alignment(gtkButton, xalign, yalign);
656 	}
657 	
658 	/**
659 	 * Gets the alignment of the child in the button.
660 	 * Since 2.4
661 	 * Params:
662 	 * xalign = return location for horizontal alignment. [out]
663 	 * yalign = return location for vertical alignment. [out]
664 	 */
665 	public void getAlignment(out float xalign, out float yalign)
666 	{
667 		// void gtk_button_get_alignment (GtkButton *button,  gfloat *xalign,  gfloat *yalign);
668 		gtk_button_get_alignment(gtkButton, &xalign, &yalign);
669 	}
670 	
671 	/**
672 	 * Set the image of button to the given widget. The image will be
673 	 * displayed if the label text is NULL or if
674 	 * "always-show-image" is TRUE. You don't have to call
675 	 * gtk_widget_show() on image yourself.
676 	 * Since 2.6
677 	 * Params:
678 	 * image = a widget to set as the image for the button
679 	 */
680 	public void setImage(Widget image)
681 	{
682 		// void gtk_button_set_image (GtkButton *button,  GtkWidget *image);
683 		gtk_button_set_image(gtkButton, (image is null) ? null : image.getWidgetStruct());
684 	}
685 	
686 	/**
687 	 * Gets the widget that is currenty set as the image of button.
688 	 * This may have been explicitly set by gtk_button_set_image()
689 	 * or constructed by gtk_button_new_from_stock().
690 	 * Since 2.6
691 	 * Returns: a GtkWidget or NULL in case there is no image. [transfer none]
692 	 */
693 	public Widget getImage()
694 	{
695 		// GtkWidget * gtk_button_get_image (GtkButton *button);
696 		auto p = gtk_button_get_image(gtkButton);
697 		
698 		if(p is null)
699 		{
700 			return null;
701 		}
702 		
703 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
704 	}
705 	
706 	/**
707 	 * Sets the position of the image relative to the text
708 	 * inside the button.
709 	 * Since 2.10
710 	 * Params:
711 	 * position = the position
712 	 */
713 	public void setImagePosition(GtkPositionType position)
714 	{
715 		// void gtk_button_set_image_position (GtkButton *button,  GtkPositionType position);
716 		gtk_button_set_image_position(gtkButton, position);
717 	}
718 	
719 	/**
720 	 * Gets the position of the image relative to the text
721 	 * inside the button.
722 	 * Since 2.10
723 	 * Returns: the position
724 	 */
725 	public GtkPositionType getImagePosition()
726 	{
727 		// GtkPositionType gtk_button_get_image_position (GtkButton *button);
728 		return gtk_button_get_image_position(gtkButton);
729 	}
730 	
731 	/**
732 	 * If TRUE, the button will always show the image in addition to the
733 	 * label, if available.
734 	 * Use this property if the button would be useless or hard to use
735 	 * without the image.
736 	 * Params:
737 	 * alwaysShow = TRUE if the menuitem should always show the image
738 	 * Since 3.6
739 	 */
740 	public void setAlwaysShowImage(int alwaysShow)
741 	{
742 		// void gtk_button_set_always_show_image (GtkButton *button,  gboolean always_show);
743 		gtk_button_set_always_show_image(gtkButton, alwaysShow);
744 	}
745 	
746 	/**
747 	 * Returns whether the button will always show the image in addition
748 	 * to the label, if available.
749 	 * Returns: TRUE if the button will always show the image Since 3.6
750 	 */
751 	public int getAlwaysShowImage()
752 	{
753 		// gboolean gtk_button_get_always_show_image (GtkButton *button);
754 		return gtk_button_get_always_show_image(gtkButton);
755 	}
756 	
757 	/**
758 	 * Returns the button's event window if it is realized, NULL otherwise.
759 	 * This function should be rarely needed.
760 	 * Since 2.22
761 	 * Returns: button's event window. [transfer none]
762 	 */
763 	public Window getEventWindow()
764 	{
765 		// GdkWindow * gtk_button_get_event_window (GtkButton *button);
766 		auto p = gtk_button_get_event_window(gtkButton);
767 		
768 		if(p is null)
769 		{
770 			return null;
771 		}
772 		
773 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
774 	}
775 }