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