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