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 * Conversion parameters: 26 * inFile = GtkCellRendererToggle.html 27 * outPack = gtk 28 * outFile = CellRendererToggle 29 * strct = GtkCellRendererToggle 30 * realStrct= 31 * ctorStrct=GtkCellRenderer 32 * clss = CellRendererToggle 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_cell_renderer_toggle_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtk.CellRenderer 49 * structWrap: 50 * - GtkCellRenderer* -> CellRenderer 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gtk.CellRendererToggle; 57 58 public import gtkc.gtktypes; 59 60 private import gtkc.gtk; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 private import gobject.Signals; 65 public import gtkc.gdktypes; 66 67 private import glib.Str; 68 private import gtk.CellRenderer; 69 70 71 72 private import gtk.CellRenderer; 73 74 /** 75 * Description 76 * GtkCellRendererToggle renders a toggle button in a cell. The 77 * button is drawn as a radio- or checkbutton, depending on the 78 * radio 79 * property. When activated, it emits the toggled signal. 80 */ 81 public class CellRendererToggle : CellRenderer 82 { 83 84 /** the main Gtk struct */ 85 protected GtkCellRendererToggle* gtkCellRendererToggle; 86 87 88 public GtkCellRendererToggle* getCellRendererToggleStruct() 89 { 90 return gtkCellRendererToggle; 91 } 92 93 94 /** the main Gtk struct as a void* */ 95 protected override void* getStruct() 96 { 97 return cast(void*)gtkCellRendererToggle; 98 } 99 100 /** 101 * Sets our main struct and passes it to the parent class 102 */ 103 public this (GtkCellRendererToggle* gtkCellRendererToggle) 104 { 105 super(cast(GtkCellRenderer*)gtkCellRendererToggle); 106 this.gtkCellRendererToggle = gtkCellRendererToggle; 107 } 108 109 protected override void setStruct(GObject* obj) 110 { 111 super.setStruct(obj); 112 gtkCellRendererToggle = cast(GtkCellRendererToggle*)obj; 113 } 114 115 /** 116 */ 117 int[string] connectedSignals; 118 119 void delegate(string, CellRendererToggle)[] onToggledListeners; 120 /** 121 * The ::toggled signal is emitted when the cell is toggled. 122 */ 123 void addOnToggled(void delegate(string, CellRendererToggle) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 124 { 125 if ( !("toggled" in connectedSignals) ) 126 { 127 Signals.connectData( 128 getStruct(), 129 "toggled", 130 cast(GCallback)&callBackToggled, 131 cast(void*)this, 132 null, 133 connectFlags); 134 connectedSignals["toggled"] = 1; 135 } 136 onToggledListeners ~= dlg; 137 } 138 extern(C) static void callBackToggled(GtkCellRendererToggle* cellRendererStruct, gchar* path, CellRendererToggle _cellRendererToggle) 139 { 140 foreach ( void delegate(string, CellRendererToggle) dlg ; _cellRendererToggle.onToggledListeners ) 141 { 142 dlg(Str.toString(path), _cellRendererToggle); 143 } 144 } 145 146 147 /** 148 * Creates a new GtkCellRendererToggle. Adjust rendering 149 * parameters using object properties. Object properties can be set 150 * globally (with g_object_set()). Also, with GtkTreeViewColumn, you 151 * can bind a property to a value in a GtkTreeModel. For example, you 152 * can bind the "active" property on the cell renderer to a boolean value 153 * in the model, thus causing the check button to reflect the state of 154 * the model. 155 * Throws: ConstructionException GTK+ fails to create the object. 156 */ 157 public this () 158 { 159 // GtkCellRenderer * gtk_cell_renderer_toggle_new (void); 160 auto p = gtk_cell_renderer_toggle_new(); 161 if(p is null) 162 { 163 throw new ConstructionException("null returned by gtk_cell_renderer_toggle_new()"); 164 } 165 this(cast(GtkCellRendererToggle*) p); 166 } 167 168 /** 169 * Returns whether we're rendering radio toggles rather than checkboxes. 170 * Returns: TRUE if we're rendering radio toggles rather than checkboxes 171 */ 172 public int getRadio() 173 { 174 // gboolean gtk_cell_renderer_toggle_get_radio (GtkCellRendererToggle *toggle); 175 return gtk_cell_renderer_toggle_get_radio(gtkCellRendererToggle); 176 } 177 178 /** 179 * If radio is TRUE, the cell renderer renders a radio toggle 180 * (i.e. a toggle in a group of mutually-exclusive toggles). 181 * If FALSE, it renders a check toggle (a standalone boolean option). 182 * This can be set globally for the cell renderer, or changed just 183 * before rendering each cell in the model (for GtkTreeView, you set 184 * up a per-row setting using GtkTreeViewColumn to associate model 185 * columns with cell renderer properties). 186 * Params: 187 * radio = TRUE to make the toggle look like a radio button 188 */ 189 public void setRadio(int radio) 190 { 191 // void gtk_cell_renderer_toggle_set_radio (GtkCellRendererToggle *toggle, gboolean radio); 192 gtk_cell_renderer_toggle_set_radio(gtkCellRendererToggle, radio); 193 } 194 195 /** 196 * Returns whether the cell renderer is active. See 197 * gtk_cell_renderer_toggle_set_active(). 198 * Returns: TRUE if the cell renderer is active. 199 */ 200 public int getActive() 201 { 202 // gboolean gtk_cell_renderer_toggle_get_active (GtkCellRendererToggle *toggle); 203 return gtk_cell_renderer_toggle_get_active(gtkCellRendererToggle); 204 } 205 206 /** 207 * Activates or deactivates a cell renderer. 208 * Params: 209 * setting = the value to set. 210 */ 211 public void setActive(int setting) 212 { 213 // void gtk_cell_renderer_toggle_set_active (GtkCellRendererToggle *toggle, gboolean setting); 214 gtk_cell_renderer_toggle_set_active(gtkCellRendererToggle, setting); 215 } 216 217 /** 218 * Returns whether the cell renderer is activatable. See 219 * gtk_cell_renderer_toggle_set_activatable(). 220 * Since 2.18 221 * Returns: TRUE if the cell renderer is activatable. 222 */ 223 public int getActivatable() 224 { 225 // gboolean gtk_cell_renderer_toggle_get_activatable (GtkCellRendererToggle *toggle); 226 return gtk_cell_renderer_toggle_get_activatable(gtkCellRendererToggle); 227 } 228 229 /** 230 * Makes the cell renderer activatable. 231 * Since 2.18 232 * Params: 233 * setting = the value to set. 234 */ 235 public void setActivatable(int setting) 236 { 237 // void gtk_cell_renderer_toggle_set_activatable (GtkCellRendererToggle *toggle, gboolean setting); 238 gtk_cell_renderer_toggle_set_activatable(gtkCellRendererToggle, setting); 239 } 240 }