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