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