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