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