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 module gtk.RadioToolButton;
26 
27 private import glib.ConstructionException;
28 private import glib.ListSG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gtk.RadioButton;
32 private import gtk.ToggleToolButton;
33 private import gtk.ToolItem;
34 private import gtkc.gtk;
35 public  import gtkc.gtktypes;
36 
37 
38 /**
39  * A #GtkRadioToolButton is a #GtkToolItem that contains a radio button,
40  * that is, a button that is part of a group of toggle buttons where only
41  * one button can be active at a time.
42  * 
43  * Use gtk_radio_tool_button_new() to create a new GtkRadioToolButton. Use
44  * gtk_radio_tool_button_new_from_widget() to create a new GtkRadioToolButton
45  * that is part of the same group as an existing GtkRadioToolButton.
46  * 
47  * # CSS nodes
48  * 
49  * GtkRadioToolButton has a single CSS node with name toolbutton.
50  */
51 public class RadioToolButton : ToggleToolButton
52 {
53 	/** the main Gtk struct */
54 	protected GtkRadioToolButton* gtkRadioToolButton;
55 
56 	/** Get the main Gtk struct */
57 	public GtkRadioToolButton* getRadioToolButtonStruct()
58 	{
59 		return gtkRadioToolButton;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gtkRadioToolButton;
66 	}
67 
68 	protected override void setStruct(GObject* obj)
69 	{
70 		gtkRadioToolButton = cast(GtkRadioToolButton*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GtkRadioToolButton* gtkRadioToolButton, bool ownedRef = false)
78 	{
79 		this.gtkRadioToolButton = gtkRadioToolButton;
80 		super(cast(GtkToggleToolButton*)gtkRadioToolButton, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_radio_tool_button_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new #GtkRadioToolButton, adding it to @group.
92 	 *
93 	 * Params:
94 	 *     group = An
95 	 *         existing radio button group, or %NULL if you are creating a new group
96 	 *
97 	 * Return: The new #GtkRadioToolButton
98 	 *
99 	 * Since: 2.4
100 	 *
101 	 * Throws: ConstructionException GTK+ fails to create the object.
102 	 */
103 	public this(ListSG group)
104 	{
105 		auto p = gtk_radio_tool_button_new((group is null) ? null : group.getListSGStruct());
106 		
107 		if(p is null)
108 		{
109 			throw new ConstructionException("null returned by new");
110 		}
111 		
112 		this(cast(GtkRadioToolButton*) p);
113 	}
114 
115 	/**
116 	 * Creates a new #GtkRadioToolButton, adding it to @group.
117 	 * The new #GtkRadioToolButton will contain an icon and label from the
118 	 * stock item indicated by @stock_id.
119 	 *
120 	 * Deprecated: Use gtk_radio_tool_button_new() instead.
121 	 *
122 	 * Params:
123 	 *     group = an existing radio button
124 	 *         group, or %NULL if you are creating a new group
125 	 *     stockId = the name of a stock item
126 	 *
127 	 * Return: The new #GtkRadioToolButton
128 	 *
129 	 * Since: 2.4
130 	 *
131 	 * Throws: ConstructionException GTK+ fails to create the object.
132 	 */
133 	public this(ListSG group, string stockId)
134 	{
135 		auto p = gtk_radio_tool_button_new_from_stock((group is null) ? null : group.getListSGStruct(), Str.toStringz(stockId));
136 		
137 		if(p is null)
138 		{
139 			throw new ConstructionException("null returned by new_from_stock");
140 		}
141 		
142 		this(cast(GtkRadioToolButton*) p);
143 	}
144 
145 	/**
146 	 * Creates a new #GtkRadioToolButton adding it to the same group as @gruup
147 	 *
148 	 * Params:
149 	 *     group = An existing #GtkRadioToolButton, or %NULL
150 	 *
151 	 * Return: The new #GtkRadioToolButton
152 	 *
153 	 * Since: 2.4
154 	 *
155 	 * Throws: ConstructionException GTK+ fails to create the object.
156 	 */
157 	public this(RadioToolButton group)
158 	{
159 		auto p = gtk_radio_tool_button_new_from_widget((group is null) ? null : group.getRadioToolButtonStruct());
160 		
161 		if(p is null)
162 		{
163 			throw new ConstructionException("null returned by new_from_widget");
164 		}
165 		
166 		this(cast(GtkRadioToolButton*) p);
167 	}
168 
169 	/**
170 	 * Creates a new #GtkRadioToolButton adding it to the same group as @group.
171 	 * The new #GtkRadioToolButton will contain an icon and label from the
172 	 * stock item indicated by @stock_id.
173 	 *
174 	 * Deprecated: gtk_radio_tool_button_new_from_widget
175 	 *
176 	 * Params:
177 	 *     group = An existing #GtkRadioToolButton.
178 	 *     stockId = the name of a stock item
179 	 *
180 	 * Return: A new #GtkRadioToolButton
181 	 *
182 	 * Since: 2.4
183 	 *
184 	 * Throws: ConstructionException GTK+ fails to create the object.
185 	 */
186 	public this(RadioToolButton group, string stockId)
187 	{
188 		auto p = gtk_radio_tool_button_new_with_stock_from_widget((group is null) ? null : group.getRadioToolButtonStruct(), Str.toStringz(stockId));
189 		
190 		if(p is null)
191 		{
192 			throw new ConstructionException("null returned by new_with_stock_from_widget");
193 		}
194 		
195 		this(cast(GtkRadioToolButton*) p);
196 	}
197 
198 	/**
199 	 * Returns the radio button group @button belongs to.
200 	 *
201 	 * Return: The group @button belongs to.
202 	 *
203 	 * Since: 2.4
204 	 */
205 	public ListSG getGroup()
206 	{
207 		auto p = gtk_radio_tool_button_get_group(gtkRadioToolButton);
208 		
209 		if(p is null)
210 		{
211 			return null;
212 		}
213 		
214 		return new ListSG(cast(GSList*) p);
215 	}
216 
217 	/**
218 	 * Adds @button to @group, removing it from the group it belonged to before.
219 	 *
220 	 * Params:
221 	 *     group = an existing radio button group, or %NULL
222 	 *
223 	 * Since: 2.4
224 	 */
225 	public void setGroup(ListSG group)
226 	{
227 		gtk_radio_tool_button_set_group(gtkRadioToolButton, (group is null) ? null : group.getListSGStruct());
228 	}
229 }