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  * 	- gtk_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gtk.CellRenderer
50  * 	- glib.ListG
51  * structWrap:
52  * 	- GList* -> ListG
53  * 	- GtkCellRenderer* -> CellRenderer
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gtk.CellLayoutT;
60 
61 public  import gtkc.gtktypes;
62 
63 public import gtkc.gtk;
64 public import glib.ConstructionException;
65 public import gobject.ObjectG;
66 
67 
68 public import glib.Str;
69 public import gtk.CellRenderer;
70 public import glib.ListG;
71 
72 
73 
74 
75 /**
76  * Description
77  * GtkCellLayout is an interface to be implemented by all objects which
78  * want to provide a GtkTreeViewColumn-like API for packing cells, setting
79  * attributes and data funcs.
80  * One of the notable features provided by implementations of GtkCellLayout
81  * are attributes. Attributes let you set the properties
82  * in flexible ways. They can just be set to constant values like regular
83  * properties. But they can also be mapped to a column of the underlying
84  * tree model with gtk_cell_layout_set_attributes(), which means that the value
85  * of the attribute can change from cell to cell as they are rendered by the
86  * cell renderer. Finally, it is possible to specify a function with
87  * gtk_cell_layout_set_cell_data_func() that is called to determine the value
88  * of the attribute for each cell that is rendered.
89  * GtkCellLayouts as GtkBuildable
90  * Implementations of GtkCellLayout which also implement the GtkBuildable
91  * interface (GtkCellView, GtkIconView, GtkComboBox, GtkComboBoxEntry,
92  * GtkEntryCompletion, GtkTreeViewColumn) accept GtkCellRenderer objects
93  * as <child> elements in UI definitions. They support a custom
94  * <attributes> element for their children, which can contain
95  * multiple <attribute> elements. Each <attribute> element has
96  * a name attribute which specifies a property of the cell renderer; the
97  * content of the element is the attribute value.
98  * $(DDOC_COMMENT example)
99  */
100 public template CellLayoutT(TStruct)
101 {
102 	
103 	/** the main Gtk struct */
104 	protected GtkCellLayout* gtkCellLayout;
105 	
106 	
107 	public GtkCellLayout* getCellLayoutTStruct()
108 	{
109 		return cast(GtkCellLayout*)getStruct();
110 	}
111 	
112 	
113 	/**
114 	 */
115 	
116 	/**
117 	 * Packs the cell into the beginning of cell_layout. If expand is FALSE,
118 	 * then the cell is allocated no more space than it needs. Any unused space
119 	 * is divided evenly between cells for which expand is TRUE.
120 	 * Note that reusing the same cell renderer is not supported.
121 	 * Since 2.4
122 	 * Params:
123 	 * cell = A GtkCellRenderer.
124 	 * expand = TRUE if cell is to be given extra space allocated to cell_layout.
125 	 */
126 	public void packStart(CellRenderer cell, int expand)
127 	{
128 		// void gtk_cell_layout_pack_start (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gboolean expand);
129 		gtk_cell_layout_pack_start(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), expand);
130 	}
131 	
132 	/**
133 	 * Adds the cell to the end of cell_layout. If expand is FALSE, then the
134 	 * cell is allocated no more space than it needs. Any unused space is
135 	 * divided evenly between cells for which expand is TRUE.
136 	 * Note that reusing the same cell renderer is not supported.
137 	 * Since 2.4
138 	 * Params:
139 	 * cell = A GtkCellRenderer.
140 	 * expand = TRUE if cell is to be given extra space allocated to cell_layout.
141 	 */
142 	public void packEnd(CellRenderer cell, int expand)
143 	{
144 		// void gtk_cell_layout_pack_end (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gboolean expand);
145 		gtk_cell_layout_pack_end(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), expand);
146 	}
147 	
148 	/**
149 	 * Returns the cell renderers which have been added to cell_layout.
150 	 * Since 2.12
151 	 * 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]
152 	 */
153 	public ListG getCells()
154 	{
155 		// GList * gtk_cell_layout_get_cells (GtkCellLayout *cell_layout);
156 		auto p = gtk_cell_layout_get_cells(getCellLayoutTStruct());
157 		
158 		if(p is null)
159 		{
160 			return null;
161 		}
162 		
163 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
164 	}
165 	
166 	/**
167 	 * Re-inserts cell at position. Note that cell has already to be packed
168 	 * into cell_layout for this to function properly.
169 	 * Since 2.4
170 	 * Params:
171 	 * cell = A GtkCellRenderer to reorder.
172 	 * position = New position to insert cell at.
173 	 */
174 	public void reorder(CellRenderer cell, int position)
175 	{
176 		// void gtk_cell_layout_reorder (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  gint position);
177 		gtk_cell_layout_reorder(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), position);
178 	}
179 	
180 	/**
181 	 * Unsets all the mappings on all renderers on cell_layout and
182 	 * removes all renderers from cell_layout.
183 	 * Since 2.4
184 	 */
185 	public void clear()
186 	{
187 		// void gtk_cell_layout_clear (GtkCellLayout *cell_layout);
188 		gtk_cell_layout_clear(getCellLayoutTStruct());
189 	}
190 	
191 	/**
192 	 * Adds an attribute mapping to the list in cell_layout. The column is the
193 	 * column of the model to get a value from, and the attribute is the
194 	 * parameter on cell to be set from the value. So for example if column 2
195 	 * of the model contains strings, you could have the "text" attribute of a
196 	 * GtkCellRendererText get its values from column 2.
197 	 * Since 2.4
198 	 * Params:
199 	 * cell = A GtkCellRenderer.
200 	 * attribute = An attribute on the renderer.
201 	 * column = The column position on the model to get the attribute from.
202 	 */
203 	public void addAttribute(CellRenderer cell, string attribute, int column)
204 	{
205 		// void gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  const gchar *attribute,  gint column);
206 		gtk_cell_layout_add_attribute(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), Str.toStringz(attribute), column);
207 	}
208 	
209 	/**
210 	 * Sets the GtkCellLayoutDataFunc to use for cell_layout. This function
211 	 * is used instead of the standard attributes mapping for setting the
212 	 * column value, and should set the value of cell_layout's cell renderer(s)
213 	 * as appropriate. func may be NULL to remove and older one.
214 	 * Since 2.4
215 	 * Params:
216 	 * cell = A GtkCellRenderer.
217 	 * func = The GtkCellLayoutDataFunc to use.
218 	 * funcData = The user data for func.
219 	 * destroy = The destroy notification for func_data.
220 	 */
221 	public void setCellDataFunc(CellRenderer cell, GtkCellLayoutDataFunc func, void* funcData, GDestroyNotify destroy)
222 	{
223 		// void gtk_cell_layout_set_cell_data_func (GtkCellLayout *cell_layout,  GtkCellRenderer *cell,  GtkCellLayoutDataFunc func,  gpointer func_data,  GDestroyNotify destroy);
224 		gtk_cell_layout_set_cell_data_func(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct(), func, funcData, destroy);
225 	}
226 	
227 	/**
228 	 * Clears all existing attributes previously set with
229 	 * gtk_cell_layout_set_attributes().
230 	 * Since 2.4
231 	 * Params:
232 	 * cell = A GtkCellRenderer to clear the attribute mapping on.
233 	 */
234 	public void clearAttributes(CellRenderer cell)
235 	{
236 		// void gtk_cell_layout_clear_attributes (GtkCellLayout *cell_layout,  GtkCellRenderer *cell);
237 		gtk_cell_layout_clear_attributes(getCellLayoutTStruct(), (cell is null) ? null : cell.getCellRendererStruct());
238 	}
239 }