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