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 = GtkCellRendererText.html 27 * outPack = gtk 28 * outFile = CellRendererText 29 * strct = GtkCellRendererText 30 * realStrct= 31 * ctorStrct=GtkCellRenderer 32 * clss = CellRendererText 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_cell_renderer_text_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - gtk.CellRenderer 49 * structWrap: 50 * - GtkCellRenderer* -> CellRenderer 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module gtk.CellRendererText; 57 58 public import gtkc.gtktypes; 59 60 private import gtkc.gtk; 61 private import glib.ConstructionException; 62 private import gobject.ObjectG; 63 64 private import gobject.Signals; 65 public import gtkc.gdktypes; 66 67 private import glib.Str; 68 private import gtk.CellRenderer; 69 70 71 72 private import gtk.CellRenderer; 73 74 /** 75 * Description 76 * A GtkCellRendererText renders a given text in its cell, using the font, color and 77 * style information provided by its properties. The text will be ellipsized if it is 78 * too long and the ellipsize 79 * property allows it. 80 * If the mode is GTK_CELL_RENDERER_MODE_EDITABLE, 81 * the GtkCellRendererText allows to edit its text using an entry. 82 */ 83 public class CellRendererText : CellRenderer 84 { 85 86 /** the main Gtk struct */ 87 protected GtkCellRendererText* gtkCellRendererText; 88 89 90 public GtkCellRendererText* getCellRendererTextStruct() 91 { 92 return gtkCellRendererText; 93 } 94 95 96 /** the main Gtk struct as a void* */ 97 protected override void* getStruct() 98 { 99 return cast(void*)gtkCellRendererText; 100 } 101 102 /** 103 * Sets our main struct and passes it to the parent class 104 */ 105 public this (GtkCellRendererText* gtkCellRendererText) 106 { 107 super(cast(GtkCellRenderer*)gtkCellRendererText); 108 this.gtkCellRendererText = gtkCellRendererText; 109 } 110 111 protected override void setStruct(GObject* obj) 112 { 113 super.setStruct(obj); 114 gtkCellRendererText = cast(GtkCellRendererText*)obj; 115 } 116 117 /** 118 */ 119 int[string] connectedSignals; 120 121 void delegate(string, string, CellRendererText)[] onEditedListeners; 122 /** 123 * This signal is emitted after renderer has been edited. 124 * It is the responsibility of the application to update the model 125 * and store new_text at the position indicated by path. 126 */ 127 void addOnEdited(void delegate(string, string, CellRendererText) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 128 { 129 if ( !("edited" in connectedSignals) ) 130 { 131 Signals.connectData( 132 getStruct(), 133 "edited", 134 cast(GCallback)&callBackEdited, 135 cast(void*)this, 136 null, 137 connectFlags); 138 connectedSignals["edited"] = 1; 139 } 140 onEditedListeners ~= dlg; 141 } 142 extern(C) static void callBackEdited(GtkCellRendererText* rendererStruct, gchar* path, gchar* newText, CellRendererText _cellRendererText) 143 { 144 foreach ( void delegate(string, string, CellRendererText) dlg ; _cellRendererText.onEditedListeners ) 145 { 146 dlg(Str.toString(path), Str.toString(newText), _cellRendererText); 147 } 148 } 149 150 151 /** 152 * Creates a new GtkCellRendererText. Adjust how text is drawn using 153 * object properties. Object properties can be 154 * set globally (with g_object_set()). Also, with GtkTreeViewColumn, 155 * you can bind a property to a value in a GtkTreeModel. For example, 156 * you can bind the "text" property on the cell renderer to a string 157 * value in the model, thus rendering a different string in each row 158 * of the GtkTreeView 159 * Throws: ConstructionException GTK+ fails to create the object. 160 */ 161 public this () 162 { 163 // GtkCellRenderer * gtk_cell_renderer_text_new (void); 164 auto p = gtk_cell_renderer_text_new(); 165 if(p is null) 166 { 167 throw new ConstructionException("null returned by gtk_cell_renderer_text_new()"); 168 } 169 this(cast(GtkCellRendererText*) p); 170 } 171 172 /** 173 * Sets the height of a renderer to explicitly be determined by the "font" and 174 * "y_pad" property set on it. Further changes in these properties do not 175 * affect the height, so they must be accompanied by a subsequent call to this 176 * function. Using this function is unflexible, and should really only be used 177 * if calculating the size of a cell is too slow (ie, a massive number of cells 178 * displayed). If number_of_rows is -1, then the fixed height is unset, and 179 * the height is determined by the properties again. 180 * Params: 181 * numberOfRows = Number of rows of text each cell renderer is allocated, or -1 182 */ 183 public void setFixedHeightFromFont(int numberOfRows) 184 { 185 // void gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer, gint number_of_rows); 186 gtk_cell_renderer_text_set_fixed_height_from_font(gtkCellRendererText, numberOfRows); 187 } 188 }