alternative to assert
[gtkD.git] / gtkD / src / gtk / ComboBoxEntry.d
blob891db2e840899213b23d82ebe5f4aa686d70de07
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkComboBoxEntry.html
26 * outPack = gtk
27 * outFile = ComboBoxEntry
28 * strct = GtkComboBoxEntry
29 * realStrct=
30 * ctorStrct=
31 * clss = ComboBoxEntry
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * - CellLayoutIF
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 * imports:
47 * - gtk.TreeModel
48 * - glib.Str
49 * - gtk.CellRenderer
50 * - gtk.CellLayoutIF
51 * - gtk.CellLayoutT
52 * structWrap:
53 * - GtkTreeModel* -> TreeModel
54 * module aliases:
55 * local aliases:
58 module gtk.ComboBoxEntry;
60 version(noAssert)
62 version(Tango)
64 import tango.io.Stdout; // use the tango loging?
68 private import gtkc.gtktypes;
70 private import gtkc.gtk;
73 private import gtk.TreeModel;
74 private import glib.Str;
75 private import gtk.CellRenderer;
76 private import gtk.CellLayoutIF;
77 private import gtk.CellLayoutT;
82 /**
83 * Description
84 * A GtkComboBoxEntry is a widget that allows the user to choose from a
85 * list of valid choices or enter a different value. It is very similar
86 * to a GtkComboBox, but it displays the selected value in an entry to
87 * allow modifying it.
88 * In contrast to a GtkComboBox, the underlying model of a GtkComboBoxEntry
89 * must always have a text column (see gtk_combo_box_entry_set_text_column()),
90 * and the entry will show the content of the text column in the selected row. To
91 * get the text from the entry, use gtk_combo_box_get_active_text().
92 * The changed signal will be emitted while typing into a GtkComboBoxEntry,
93 * as well as when selecting an item from the GtkComboBoxEntry's list. Use
94 * gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover
95 * whether an item was actually selected from the list.
96 * Connect to the activate signal of the GtkEntry (use gtk_bin_get_child()) to
97 * detect when the user actually finishes entering text.
98 * The convenience API to construct simple text-only GtkComboBoxes can
99 * also be used with GtkComboBoxEntrys which have been constructed
100 * with gtk_combo_box_entry_new_text().
102 private import gtk.ComboBox;
103 public class ComboBoxEntry : ComboBox, CellLayoutIF
106 /** the main Gtk struct */
107 protected GtkComboBoxEntry* gtkComboBoxEntry;
110 public GtkComboBoxEntry* getComboBoxEntryStruct()
112 return gtkComboBoxEntry;
116 /** the main Gtk struct as a void* */
117 protected void* getStruct()
119 return cast(void*)gtkComboBoxEntry;
123 * Sets our main struct and passes it to the parent class
125 public this (GtkComboBoxEntry* gtkComboBoxEntry)
127 version(noAssert)
129 if ( gtkComboBoxEntry is null )
131 int zero = 0;
132 version(Tango)
134 Stdout("struct gtkComboBoxEntry is null on constructor").newline;
136 else
138 printf("struct gtkComboBoxEntry is null on constructor");
140 zero = zero / zero;
143 else
145 assert(gtkComboBoxEntry !is null, "struct gtkComboBoxEntry is null on constructor");
147 super(cast(GtkComboBox*)gtkComboBoxEntry);
148 this.gtkComboBoxEntry = gtkComboBoxEntry;
151 mixin CellLayoutT!(GtkComboBoxEntry);
153 * Creates a new GtkComboBoxEntry which has a GtkEntry as child. After
154 * construction, you should set a model using gtk_combo_box_set_model() and a
155 * text_column * using gtk_combo_box_entry_set_text_column().
156 * Returns:
157 * A new GtkComboBoxEntry.
158 * Since 2.4
160 public this (bool text=true)
162 if ( text )
164 // GtkWidget* gtk_combo_box_entry_new_text (void);
165 this(cast(GtkComboBoxEntry*)gtk_combo_box_entry_new_text() );
167 else
169 // GtkWidget* gtk_combo_box_entry_new (void);
170 this(cast(GtkComboBoxEntry*)gtk_combo_box_entry_new() );
181 * Creates a new GtkComboBoxEntry which has a GtkEntry as child and a list
182 * of strings as popup. You can get the GtkEntry from a GtkComboBoxEntry
183 * using GTK_ENTRY (GTK_BIN (combo_box_entry)->child). To add and remove
184 * strings from the list, just modify model using its data manipulation
185 * API.
186 * model:
187 * A GtkTreeModel.
188 * text_column:
189 * A column in model to get the strings from.
190 * Returns:
191 * A new GtkComboBoxEntry.
192 * Since 2.4
194 public this (TreeModel model, int textColumn)
196 // GtkWidget* gtk_combo_box_entry_new_with_model (GtkTreeModel *model, gint text_column);
197 this(cast(GtkComboBoxEntry*)gtk_combo_box_entry_new_with_model((model is null) ? null : model.getTreeModelStruct(), textColumn) );
202 * Sets the model column which entry_box should use to get strings from
203 * to be text_column.
204 * entry_box:
205 * A GtkComboBoxEntry.
206 * text_column:
207 * A column in model to get the strings from.
208 * Since 2.4
210 public void setTextColumn(int textColumn)
212 // void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box, gint text_column);
213 gtk_combo_box_entry_set_text_column(gtkComboBoxEntry, textColumn);
217 * Returns the column which entry_box is using to get the strings from.
218 * entry_box:
219 * A GtkComboBoxEntry.
220 * Returns:
221 * A column in the data source model of entry_box.
222 * Since 2.4
223 * Property Details
224 * The "text-column" property
225 * "text-column" gint : Read / Write
226 * A column in the data source model to get the strings from.
227 * Allowed values: >= -1
228 * Default value: -1
229 * See Also
230 * GtkComboBox
232 public int getTextColumn()
234 // gint gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box);
235 return gtk_combo_box_entry_get_text_column(gtkComboBoxEntry);