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 = GtkComboBoxEntry.html 27 * outPack = gtk 28 * outFile = ComboBoxEntry 29 * strct = GtkComboBoxEntry 30 * realStrct= 31 * ctorStrct= 32 * clss = ComboBoxEntry 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_combo_box_entry_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - gtk_combo_box_entry_new 45 * - gtk_combo_box_entry_new_text 46 * omit signals: 47 * imports: 48 * - gtk.TreeModelIF 49 * - gtk.Adjustment 50 * structWrap: 51 * - GtkAdjustment* -> Adjustment 52 * - GtkTreeModel* -> TreeModelIF 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.ComboBoxEntry; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 67 private import gtk.TreeModelIF; 68 private import gtk.Adjustment; 69 70 71 72 private import gtk.ComboBox; 73 74 /** 75 * Description 76 * A GtkComboBoxEntry is a widget that allows the user to choose from a 77 * list of valid choices or enter a different value. It is very similar 78 * to a GtkComboBox, but it displays the selected value in an entry to 79 * allow modifying it. 80 * In contrast to a GtkComboBox, the underlying model of a GtkComboBoxEntry 81 * must always have a text column (see gtk_combo_box_entry_set_text_column()), 82 * and the entry will show the content of the text column in the selected row. 83 * To get the text from the entry, use gtk_combo_box_get_active_text(). 84 * The changed signal will be emitted while typing into a GtkComboBoxEntry, 85 * as well as when selecting an item from the GtkComboBoxEntry's list. Use 86 * gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover 87 * whether an item was actually selected from the list. 88 * Connect to the activate signal of the GtkEntry (use gtk_bin_get_child()) 89 * to detect when the user actually finishes entering text. 90 * The convenience API to construct simple text-only GtkComboBoxes 91 * can also be used with GtkComboBoxEntrys which have been constructed 92 * with gtk_combo_box_entry_new_text(). 93 * If you have special needs that go beyond a simple entry (e.g. input validation), 94 * it is possible to replace the child entry by a different widget using 95 * gtk_container_remove() and gtk_container_add(). 96 * GtkComboBoxEntry as GtkBuildable 97 * Beyond the <attributes> support that is shared by all 98 * GtkCellLayout implementation, 99 * GtkComboBoxEntry makes the entry available in UI definitions as an internal 100 * child with name "entry". 101 */ 102 public class ComboBoxEntry : ComboBox 103 { 104 105 /** the main Gtk struct */ 106 protected GtkComboBoxEntry* gtkComboBoxEntry; 107 108 109 public GtkComboBoxEntry* getComboBoxEntryStruct() 110 { 111 return gtkComboBoxEntry; 112 } 113 114 115 /** the main Gtk struct as a void* */ 116 protected override void* getStruct() 117 { 118 return cast(void*)gtkComboBoxEntry; 119 } 120 121 /** 122 * Sets our main struct and passes it to the parent class 123 */ 124 public this (GtkComboBoxEntry* gtkComboBoxEntry) 125 { 126 super(cast(GtkComboBox*)gtkComboBoxEntry); 127 this.gtkComboBoxEntry = gtkComboBoxEntry; 128 } 129 130 protected override void setStruct(GObject* obj) 131 { 132 super.setStruct(obj); 133 gtkComboBoxEntry = cast(GtkComboBoxEntry*)obj; 134 } 135 136 /** 137 * Creates a new GtkComboBoxEntry which has a GtkEntry as child. After 138 * construction, you should set a model using gtk_combo_box_set_model() and a 139 * text_column * using gtk_combo_box_entry_set_text_column(). 140 * Since 2.4 141 * Returns: 142 * A new GtkComboBoxEntry. 143 * Throws: ConstructionException GTK+ fails to create the object. 144 */ 145 public this (bool text=true) 146 { 147 GtkComboBoxEntry* p; 148 149 if ( text ) 150 { 151 // GtkWidget* gtk_combo_box_entry_new_text (void); 152 p = cast(GtkComboBoxEntry*)gtk_combo_box_entry_new_text(); 153 } 154 else 155 { 156 // GtkWidget* gtk_combo_box_entry_new (void); 157 p = cast(GtkComboBoxEntry*)gtk_combo_box_entry_new(); 158 } 159 160 if(p is null) 161 { 162 throw new ConstructionException("null returned by gtk_combo_box_entry_new"); 163 } 164 165 this(p); 166 } 167 168 /** 169 */ 170 171 /** 172 * Warning 173 * gtk_combo_box_entry_new_with_model has been deprecated since version 2.24 and should not be used in newly-written code. Use gtk_combo_box_new_with_model_and_entry() instead 174 * Creates a new GtkComboBoxEntry which has a GtkEntry as child and a list 175 * of strings as popup. You can get the GtkEntry from a GtkComboBoxEntry 176 * using GTK_ENTRY (GTK_BIN (combo_box_entry)->child). To add and remove 177 * strings from the list, just modify model using its data manipulation 178 * API. 179 * Since 2.4 180 * Params: 181 * model = A GtkTreeModel. 182 * textColumn = A column in model to get the strings from. 183 * Throws: ConstructionException GTK+ fails to create the object. 184 */ 185 public this (TreeModelIF model, int textColumn) 186 { 187 // GtkWidget * gtk_combo_box_entry_new_with_model (GtkTreeModel *model, gint text_column); 188 auto p = gtk_combo_box_entry_new_with_model((model is null) ? null : model.getTreeModelTStruct(), textColumn); 189 if(p is null) 190 { 191 throw new ConstructionException("null returned by gtk_combo_box_entry_new_with_model((model is null) ? null : model.getTreeModelTStruct(), textColumn)"); 192 } 193 this(cast(GtkComboBoxEntry*) p); 194 } 195 196 /** 197 * Warning 198 * gtk_combo_box_entry_set_text_column has been deprecated since version 2.24 and should not be used in newly-written code. Use gtk_combo_box_set_entry_text_column() instead 199 * Sets the model column which entry_box should use to get strings from 200 * to be text_column. 201 * Since 2.4 202 * Params: 203 * textColumn = A column in model to get the strings from. 204 */ 205 public void setTextColumn(int textColumn) 206 { 207 // void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box, gint text_column); 208 gtk_combo_box_entry_set_text_column(gtkComboBoxEntry, textColumn); 209 } 210 211 /** 212 * Warning 213 * gtk_combo_box_entry_get_text_column has been deprecated since version 2.24 and should not be used in newly-written code. Use gtk_combo_box_get_entry_text_column() instead 214 * Returns the column which entry_box is using to get the strings from. 215 * Since 2.4 216 * Returns: A column in the data source model of entry_box. 217 */ 218 public int getTextColumn() 219 { 220 // gint gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box); 221 return gtk_combo_box_entry_get_text_column(gtkComboBoxEntry); 222 } 223 }