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  = GtkCellLayout.html
27  * outPack = gtk
28  * outFile = CellLayoutT
29  * strct   = GtkCellLayout
30  * realStrct=
31  * ctorStrct=
32  * clss    = CellLayoutT
33  * interf  = CellLayoutIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_cell_layout_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ListG
49  * 	- gtk.CellArea
50  * 	- gtk.CellRenderer
51  * structWrap:
52  * 	- GList* -> ListG
53  * 	- GtkCellArea* -> CellArea
54  * 	- GtkCellRenderer* -> CellRenderer
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gtk.CellLayoutT;
61 
62 public  import gtkc.gtktypes;
63 
64 public import gtkc.gtk;
65 public import glib.ConstructionException;
66 public import gobject.ObjectG;
67 
68 
69 public import glib.Str;
70 public import glib.ListG;
71 public import gtk.CellArea;
72 public import gtk.CellRenderer;
73 
74 
75 
76 
77 /**
78  * GtkCellLayout is an interface to be implemented by all objects which
79  * want to provide a GtkTreeViewColumn-like API for packing cells, setting
80  * attributes and data funcs.
81  *
82  * One of the notable features provided by implementations of GtkCellLayout
83  * are attributes. Attributes let you set the properties
84  * in flexible ways. They can just be set to constant values like regular
85  * properties. But they can also be mapped to a column of the underlying
86  * tree model with gtk_cell_layout_set_attributes(), which means that the value
87  * of the attribute can change from cell to cell as they are rendered by the
88  * cell renderer. Finally, it is possible to specify a function with
89  * gtk_cell_layout_set_cell_data_func() that is called to determine the value
90  * of the attribute for each cell that is rendered.
91  *
92  * GtkCellLayouts as GtkBuildable
93  *
94  * Implementations of GtkCellLayout which also implement the GtkBuildable
95  * interface (GtkCellView, GtkIconView, GtkComboBox,
96  * GtkEntryCompletion, GtkTreeViewColumn) accept GtkCellRenderer objects
97  * as <child> elements in UI definitions. They support a custom
98  * <attributes> element for their children, which can contain
99  * multiple <attribute> elements. Each <attribute> element has
100  * a name attribute which specifies a property of the cell renderer; the
101  * content of the element is the attribute value.
102  *
103  * $(DDOC_COMMENT example)
104  *
105  * Furthermore for implementations of GtkCellLayout that use a GtkCellArea
106  * to lay out cells (all GtkCellLayouts in GTK+ use a GtkCellArea)
107  * cell properties can also be defined
108  * in the format by specifying the custom <cell-packing> attribute which
109  * can contain multiple <property> elements defined in the normal way.
110  *
111  * $(DDOC_COMMENT example)
112  *
113  * Subclassing GtkCellLayout implementations
114  *
115  * When subclassing a widget that implements GtkCellLayout like
116  * GtkIconView or GtkComboBox, there are some considerations related
117  * to the fact that these widgets internally use a GtkCellArea.
118  * The cell area is exposed as a construct-only property by these
119  * widgets. This means that it is possible to e.g. do
120  *
121  * $(DDOC_COMMENT example)
122  *
123  * to use a custom cell area with a combo box. But construct properties
124  * are only initialized after instance init()
125  * functions have run, which means that using functions which rely on
126  * the existence of the cell area in your subclass' init() function will
127  * cause the default cell area to be instantiated. In this case, a provided
128  * construct property value will be ignored (with a warning, to alert
129  * you to the problem).
130  *
131  * $(DDOC_COMMENT example)
132  *
133  * If supporting alternative cell areas with your derived widget is
134  * not important, then this does not have to concern you. If you want
135  * to support alternative cell areas, you can do so by moving the
136  * problematic calls out of init() and into a constructor()
137  * for your class.
138  */
139 public template CellLayoutT(TStruct)
140 {
141 	
142 	/** the main Gtk struct */
143 	protected GtkCellLayout* gtkCellLayout;
144 	
145 	
146 	public GtkCellLayout* getCellLayoutTStruct()
147 	{
148 		return cast(GtkCellLayout*)getStruct();
149 	}
150 	
151 	
152 	/**
153 	 */
154 	
155 	/**
156 	 * Packs the cell into the beginning of cell_layout. If expand is FALSE,
157 	 * then the cell is allocated no more space than it needs. Any unused space
158 	 * is divided evenly between cells for which expand is TRUE.
159 	 * Note that reusing the same cell renderer is not supported.
160 	 * Since 2.4
161 	 * Params:
162 	 * cell = a GtkCellRenderer
163 	 * expand = TRUE if cell is to be given extra space allocated to cell_layout
164 	 */
165 	public void packStart(CellRenderer cell, int expand)
166 	{
167 		// void gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gboolean expand);
168 		gtk_cell_layout_pack_start(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), expand);
169 	}
170 	
171 	/**
172 	 * Adds the cell to the end of cell_layout. If expand is FALSE, then the
173 	 * cell is allocated no more space than it needs. Any unused space is
174 	 * divided evenly between cells for which expand is TRUE.
175 	 * Note that reusing the same cell renderer is not supported.
176 	 * Since 2.4
177 	 * Params:
178 	 * cell = a GtkCellRenderer
179 	 * expand = TRUE if cell is to be given extra space allocated to cell_layout
180 	 */
181 	public void packEnd(CellRenderer cell, int expand)
182 	{
183 		// void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gboolean expand);
184 		gtk_cell_layout_pack_end(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), expand);
185 	}
186 	
187 	/**
188 	 * Returns the underlying GtkCellArea which might be cell_layout
189 	 * if called on a GtkCellArea or might be NULL if no GtkCellArea
190 	 * is used by cell_layout.
191 	 * Returns: the cell area used by cell_layout. [transfer none] Since 3.0
192 	 */
193 	public CellArea getArea()
194 	{
195 		// GtkCellArea * gtk_cell_layout_get_area (GtkCellLayout *cell_layout);
196 		auto p = gtk_cell_layout_get_area(getCellLayoutTStruct());
197 		
198 		if(p is null)
199 		{
200 			return null;
201 		}
202 		
203 		return ObjectG.getDObject!(CellArea)(cast(GtkCellArea*) p);
204 	}
205 	
206 	/**
207 	 * Returns the cell renderers which have been added to cell_layout.
208 	 * Since 2.12
209 	 * Returns: a list of cell renderers. The list, but not the renderers has been newly allocated and should be freed with g_list_free() when no longer needed. [element-type GtkCellRenderer][transfer container]
210 	 */
211 	public ListG getCells()
212 	{
213 		// GList * gtk_cell_layout_get_cells (GtkCellLayout *cell_layout);
214 		auto p = gtk_cell_layout_get_cells(getCellLayoutTStruct());
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
222 	}
223 	
224 	/**
225 	 * Re-inserts cell at position.
226 	 * Note that cell has already to be packed into cell_layout
227 	 * for this to function properly.
228 	 * Since 2.4
229 	 * Params:
230 	 * cell = a GtkCellRenderer to reorder
231 	 * position = new position to insert cell at
232 	 */
233 	public void reorder(CellRenderer cell, int position)
234 	{
235 		// void gtk_cell_layout_reorder (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gint position);
236 		gtk_cell_layout_reorder(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), position);
237 	}
238 	
239 	/**
240 	 * Unsets all the mappings on all renderers on cell_layout and
241 	 * removes all renderers from cell_layout.
242 	 * Since 2.4
243 	 */
244 	public void clear()
245 	{
246 		// void gtk_cell_layout_clear (GtkCellLayout *cell_layout);
247 		gtk_cell_layout_clear(getCellLayoutTStruct());
248 	}
249 	
250 	/**
251 	 * Adds an attribute mapping to the list in cell_layout.
252 	 * The column is the column of the model to get a value from, and the
253 	 * attribute is the parameter on cell to be set from the value. So for
254 	 * example if column 2 of the model contains strings, you could have the
255 	 * "text" attribute of a GtkCellRendererText get its values from column 2.
256 	 * Since 2.4
257 	 * Params:
258 	 * cell = a GtkCellRenderer
259 	 * attribute = an attribute on the renderer
260 	 * column = the column position on the model to get the attribute from
261 	 */
262 	public void addAttribute(CellRenderer cell, string attribute, int column)
263 	{
264 		// void gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  const gchar *attribute,  gint column);
265 		gtk_cell_layout_add_attribute(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), Str.toStringz(attribute), column);
266 	}
267 	
268 	/**
269 	 * Sets the GtkCellLayoutDataFunc to use for cell_layout.
270 	 * This function is used instead of the standard attributes mapping
271 	 * for setting the column value, and should set the value of cell_layout's
272 	 * cell renderer(s) as appropriate.
273 	 * func may be NULL to remove a previously set function.
274 	 * Since 2.4
275 	 * Params:
276 	 * cell = a GtkCellRenderer
277 	 * func = the GtkCellLayoutDataFunc to use, or NULL. [allow-none]
278 	 * funcData = user data for func
279 	 * destroy = destroy notify for func_data
280 	 */
281 	public void setCellDataFunc(CellRenderer cell, GtkCellLayoutDataFunc func, void* funcData, GDestroyNotify destroy)
282 	{
283 		// void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  GtkCellLayoutDataFunc func,  gpointer func_data,  GDestroyNotify destroy);
284 		gtk_cell_layout_set_cell_data_func(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), func, funcData, destroy);
285 	}
286 	
287 	/**
288 	 * Clears all existing attributes previously set with
289 	 * gtk_cell_layout_set_attributes().
290 	 * Since 2.4
291 	 * Params:
292 	 * cell = a GtkCellRenderer to clear the attribute mapping on
293 	 */
294 	public void clearAttributes(CellRenderer cell)
295 	{
296 		// void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,  GtkCellRenderer *cell);
297 		gtk_cell_layout_clear_attributes(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct());
298 	}
299 }