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