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 = GtkCellRendererCombo.html 27 * outPack = gtk 28 * outFile = CellRendererCombo 29 * strct = GtkCellRendererCombo 30 * realStrct= 31 * ctorStrct=GtkCellRenderer 32 * clss = CellRendererCombo 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_cell_renderer_combo_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtk.CellRenderer 49 * - gtk.TreeIter 50 * structWrap: 51 * - GtkCellRenderer* -> CellRenderer 52 * - GtkTreeIter* -> TreeIter 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.CellRendererCombo; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import gobject.Signals; 67 public import gtkc.gdktypes; 68 69 private import glib.Str; 70 private import gtk.CellRenderer; 71 private import gtk.TreeIter; 72 73 74 75 private import gtk.CellRendererText; 76 77 /** 78 * Description 79 * GtkCellRendererCombo renders text in a cell like GtkCellRendererText from 80 * which it is derived. But while GtkCellRendererText offers a simple entry to 81 * edit the text, GtkCellRendererCombo offers a GtkComboBox or GtkComboBoxEntry 82 * widget to edit the text. The values to display in the combo box are taken from 83 * the tree model specified in the 84 * model property. 85 * The combo cell renderer takes care of adding a text cell renderer to the combo 86 * box and sets it to display the column specified by its 87 * text-column 88 * property. Further properties of the comnbo box can be set in a handler for the 89 * editing-started signal. 90 * The GtkCellRendererCombo cell renderer was added in GTK+ 2.6. 91 */ 92 public class CellRendererCombo : CellRendererText 93 { 94 95 /** the main Gtk struct */ 96 protected GtkCellRendererCombo* gtkCellRendererCombo; 97 98 99 public GtkCellRendererCombo* getCellRendererComboStruct() 100 { 101 return gtkCellRendererCombo; 102 } 103 104 105 /** the main Gtk struct as a void* */ 106 protected override void* getStruct() 107 { 108 return cast(void*)gtkCellRendererCombo; 109 } 110 111 /** 112 * Sets our main struct and passes it to the parent class 113 */ 114 public this (GtkCellRendererCombo* gtkCellRendererCombo) 115 { 116 super(cast(GtkCellRendererText*)gtkCellRendererCombo); 117 this.gtkCellRendererCombo = gtkCellRendererCombo; 118 } 119 120 protected override void setStruct(GObject* obj) 121 { 122 super.setStruct(obj); 123 gtkCellRendererCombo = cast(GtkCellRendererCombo*)obj; 124 } 125 126 /** 127 */ 128 int[string] connectedSignals; 129 130 void delegate(string, TreeIter, CellRendererCombo)[] onChangedListeners; 131 /** 132 * This signal is emitted each time after the user selected an item in 133 * the combo box, either by using the mouse or the arrow keys. Contrary 134 * to GtkComboBox, GtkCellRendererCombo::changed is not emitted for 135 * changes made to a selected item in the entry. The argument new_iter 136 * corresponds to the newly selected item in the combo box and it is relative 137 * to the GtkTreeModel set via the model property on GtkCellRendererCombo. 138 * Note that as soon as you change the model displayed in the tree view, 139 * the tree view will immediately cease the editing operating. This 140 * means that you most probably want to refrain from changing the model 141 * until the combo cell renderer emits the edited or editing_canceled signal. 142 * Since 2.14 143 */ 144 void addOnChanged(void delegate(string, TreeIter, CellRendererCombo) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 145 { 146 if ( !("changed" in connectedSignals) ) 147 { 148 Signals.connectData( 149 getStruct(), 150 "changed", 151 cast(GCallback)&callBackChanged, 152 cast(void*)this, 153 null, 154 connectFlags); 155 connectedSignals["changed"] = 1; 156 } 157 onChangedListeners ~= dlg; 158 } 159 extern(C) static void callBackChanged(GtkCellRendererCombo* comboStruct, gchar* pathString, GtkTreeIter* newIter, CellRendererCombo _cellRendererCombo) 160 { 161 foreach ( void delegate(string, TreeIter, CellRendererCombo) dlg ; _cellRendererCombo.onChangedListeners ) 162 { 163 dlg(Str.toString(pathString), ObjectG.getDObject!(TreeIter)(newIter), _cellRendererCombo); 164 } 165 } 166 167 168 /** 169 * Creates a new GtkCellRendererCombo. 170 * Adjust how text is drawn using object properties. 171 * Object properties can be set globally (with g_object_set()). 172 * Also, with GtkTreeViewColumn, you can bind a property to a value 173 * in a GtkTreeModel. For example, you can bind the "text" property 174 * on the cell renderer to a string value in the model, thus rendering 175 * a different string in each row of the GtkTreeView. 176 * Since 2.6 177 * Throws: ConstructionException GTK+ fails to create the object. 178 */ 179 public this () 180 { 181 // GtkCellRenderer * gtk_cell_renderer_combo_new (void); 182 auto p = gtk_cell_renderer_combo_new(); 183 if(p is null) 184 { 185 throw new ConstructionException("null returned by gtk_cell_renderer_combo_new()"); 186 } 187 this(cast(GtkCellRendererCombo*) p); 188 } 189 }