1 /*
2  * This file is part of d-handy.
3  *
4  * d-handy 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  * d-handy 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 d-handy; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 module handy.DialerButton;
20 
21 private import glib.ConstructionException;
22 private import glib.Str;
23 private import gobject.ObjectG;
24 private import gtk.ActionableIF;
25 private import gtk.ActionableT;
26 private import gtk.ActivatableIF;
27 private import gtk.ActivatableT;
28 private import gtk.BuildableIF;
29 private import gtk.BuildableT;
30 private import gtk.Button;
31 private import gtk.Widget;
32 private import handy.c.functions;
33 public  import handy.c.types;
34 
35 
36 /** */
37 public class DialerButton : Button
38 {
39 	/** the main Gtk struct */
40 	protected HdyDialerButton* hdyDialerButton;
41 
42 	/** Get the main Gtk struct */
43 	public HdyDialerButton* getDialerButtonStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return hdyDialerButton;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)hdyDialerButton;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (HdyDialerButton* hdyDialerButton, bool ownedRef = false)
60 	{
61 		this.hdyDialerButton = hdyDialerButton;
62 		super(cast(GtkButton*)hdyDialerButton, ownedRef);
63 	}
64 
65 
66 	/** */
67 	public static GType getType()
68 	{
69 		return hdy_dialer_button_get_type();
70 	}
71 
72 	/**
73 	 * Create a new #HdyDialerButton which displays
74 	 * @symbols. If
75 	 * @symbols is %NULL no symbols will be displayed.
76 	 *
77 	 * Params:
78 	 *     symbols = the symbols displayed on the #HdyDialerButton
79 	 *
80 	 * Returns: the newly created #HdyDialerButton widget
81 	 *
82 	 * Throws: ConstructionException GTK+ fails to create the object.
83 	 */
84 	public this(string symbols)
85 	{
86 		auto p = hdy_dialer_button_new(Str.toStringz(symbols));
87 
88 		if(p is null)
89 		{
90 			throw new ConstructionException("null returned by new");
91 		}
92 
93 		this(cast(HdyDialerButton*) p);
94 	}
95 
96 	/**
97 	 * Get the #HdyDialerButton's digit.
98 	 *
99 	 * Returns: the button's digit
100 	 */
101 	public int getDigit()
102 	{
103 		return hdy_dialer_button_get_digit(hdyDialerButton);
104 	}
105 
106 	/**
107 	 * Get the #HdyDialerButton's symbols.
108 	 *
109 	 * Returns: the button's symbols.
110 	 */
111 	public string getSymbols()
112 	{
113 		return Str.toString(hdy_dialer_button_get_symbols(hdyDialerButton));
114 	}
115 }