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