alternative to assert
[gtkD.git] / gtkD / src / gtk / CellRendererText.d
blobfb284f6eed64e08f20ee09087f40d0a3fccdf10f
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkCellRendererText.html
26 * outPack = gtk
27 * outFile = CellRendererText
28 * strct = GtkCellRenderer
29 * realStrct=GtkCellRendererText
30 * ctorStrct=
31 * clss = CellRendererText
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_cell_renderer_text_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.CellRenderer
47 * structWrap:
48 * - GtkCellRenderer* -> CellRenderer
49 * module aliases:
50 * local aliases:
53 module gtk.CellRendererText;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gtktypes;
65 private import gtkc.gtk;
68 private import glib.Str;
69 private import gtk.CellRenderer;
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.
83 private import gtk.CellRenderer;
84 public class CellRendererText : CellRenderer
87 /** the main Gtk struct */
88 protected GtkCellRendererText* gtkCellRendererText;
91 public GtkCellRendererText* getCellRendererTextStruct()
93 return gtkCellRendererText;
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gtkCellRendererText;
104 * Sets our main struct and passes it to the parent class
106 public this (GtkCellRendererText* gtkCellRendererText)
108 version(noAssert)
110 if ( gtkCellRendererText is null )
112 int zero = 0;
113 version(Tango)
115 Stdout("struct gtkCellRendererText is null on constructor").newline;
117 else
119 printf("struct gtkCellRendererText is null on constructor");
121 zero = zero / zero;
124 else
126 assert(gtkCellRendererText !is null, "struct gtkCellRendererText is null on constructor");
128 super(cast(GtkCellRenderer*)gtkCellRendererText);
129 this.gtkCellRendererText = gtkCellRendererText;
135 // imports for the signal processing
136 private import gobject.Signals;
137 private import gtkc.gdktypes;
138 int[char[]] connectedSignals;
140 void delegate(char[], char[], CellRendererText)[] onEditedListeners;
141 void addOnEdited(void delegate(char[], char[], CellRendererText) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
143 if ( !("edited" in connectedSignals) )
145 Signals.connectData(
146 getStruct(),
147 "edited",
148 cast(GCallback)&callBackEdited,
149 cast(void*)this,
150 null,
151 connectFlags);
152 connectedSignals["edited"] = 1;
154 onEditedListeners ~= dlg;
156 extern(C) static void callBackEdited(GtkCellRendererText* rendererStruct, gchar* path, gchar* newText, CellRendererText cellRendererText)
158 bool consumed = false;
160 foreach ( void delegate(char[], char[], CellRendererText) dlg ; cellRendererText.onEditedListeners )
162 dlg(Str.toString(path), Str.toString(newText), cellRendererText);
165 return consumed;
171 * Creates a new GtkCellRendererText. Adjust how text is drawn using
172 * object properties. Object properties can be
173 * set globally (with g_object_set()). Also, with GtkTreeViewColumn,
174 * you can bind a property to a value in a GtkTreeModel. For example,
175 * you can bind the "text" property on the cell renderer to a string
176 * value in the model, thus rendering a different string in each row
177 * of the GtkTreeView
178 * Returns:
179 * the new cell renderer
181 public this ()
183 // GtkCellRenderer* gtk_cell_renderer_text_new (void);
184 this(cast(GtkCellRendererText*)gtk_cell_renderer_text_new() );
188 * Sets the height of a renderer to explicitly be determined by the "font" and
189 * "y_pad" property set on it. Further changes in these properties do not
190 * affect the height, so they must be accompanied by a subsequent call to this
191 * function. Using this function is unflexible, and should really only be used
192 * if calculating the size of a cell is too slow (ie, a massive number of cells
193 * displayed). If number_of_rows is -1, then the fixed height is unset, and
194 * the height is determined by the properties again.
195 * renderer:
196 * A GtkCellRendererText
197 * number_of_rows:
198 * Number of rows of text each cell renderer is allocated, or -1
199 * Property Details
200 * The "align-set" property
201 * "align-set" gboolean : Read / Write
202 * Whether this tag affects the alignment mode.
203 * Default value: FALSE
205 public static void setFixedHeightFromFont(GtkCellRendererText* renderer, int numberOfRows)
207 // void gtk_cell_renderer_text_set_fixed_height_from_font (GtkCellRendererText *renderer, gint number_of_rows);
208 gtk_cell_renderer_text_set_fixed_height_from_font(renderer, numberOfRows);