alternative to assert
[gtkD.git] / gtkD / src / gtk / TextTagTable.d
blob408a1f6930f27652202f9056f6f407e2656265d2
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 = GtkTextTagTable.html
26 * outPack = gtk
27 * outFile = TextTagTable
28 * strct = GtkTextTagTable
29 * realStrct=
30 * ctorStrct=
31 * clss = TextTagTable
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_text_tag_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.TextTagTable
47 * - gtk.TextTag
48 * structWrap:
49 * - GtkTextTag* -> TextTag
50 * - GtkTextTagTable* -> TextTagTable
51 * module aliases:
52 * local aliases:
55 module gtk.TextTagTable;
57 version(noAssert)
59 version(Tango)
61 import tango.io.Stdout; // use the tango loging?
65 private import gtkc.gtktypes;
67 private import gtkc.gtk;
70 private import glib.Str;
71 private import gtk.TextTagTable;
72 private import gtk.TextTag;
77 /**
78 * Description
79 * You may wish to begin by reading the text widget
80 * conceptual overview which gives an overview of all the objects and data
81 * types related to the text widget and how they work together.
83 private import gobject.ObjectG;
84 public class TextTagTable : ObjectG
87 /** the main Gtk struct */
88 protected GtkTextTagTable* gtkTextTagTable;
91 public GtkTextTagTable* getTextTagTableStruct()
93 return gtkTextTagTable;
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gtkTextTagTable;
104 * Sets our main struct and passes it to the parent class
106 public this (GtkTextTagTable* gtkTextTagTable)
108 version(noAssert)
110 if ( gtkTextTagTable is null )
112 int zero = 0;
113 version(Tango)
115 Stdout("struct gtkTextTagTable is null on constructor").newline;
117 else
119 printf("struct gtkTextTagTable is null on constructor");
121 zero = zero / zero;
124 else
126 assert(gtkTextTagTable !is null, "struct gtkTextTagTable is null on constructor");
128 super(cast(GObject*)gtkTextTagTable);
129 this.gtkTextTagTable = gtkTextTagTable;
135 // imports for the signal processing
136 private import gobject.Signals;
137 private import gtkc.gdktypes;
138 int[char[]] connectedSignals;
140 void delegate(TextTag, TextTagTable)[] onTagAddedListeners;
141 void addOnTagAdded(void delegate(TextTag, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
143 if ( !("tag-added" in connectedSignals) )
145 Signals.connectData(
146 getStruct(),
147 "tag-added",
148 cast(GCallback)&callBackTagAdded,
149 cast(void*)this,
150 null,
151 connectFlags);
152 connectedSignals["tag-added"] = 1;
154 onTagAddedListeners ~= dlg;
156 extern(C) static void callBackTagAdded(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable textTagTable)
158 bool consumed = false;
160 foreach ( void delegate(TextTag, TextTagTable) dlg ; textTagTable.onTagAddedListeners )
162 dlg(new TextTag(arg1), textTagTable);
165 return consumed;
168 void delegate(TextTag, gboolean, TextTagTable)[] onTagChangedListeners;
169 void addOnTagChanged(void delegate(TextTag, gboolean, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
171 if ( !("tag-changed" in connectedSignals) )
173 Signals.connectData(
174 getStruct(),
175 "tag-changed",
176 cast(GCallback)&callBackTagChanged,
177 cast(void*)this,
178 null,
179 connectFlags);
180 connectedSignals["tag-changed"] = 1;
182 onTagChangedListeners ~= dlg;
184 extern(C) static void callBackTagChanged(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, gboolean arg2, TextTagTable textTagTable)
186 bool consumed = false;
188 foreach ( void delegate(TextTag, gboolean, TextTagTable) dlg ; textTagTable.onTagChangedListeners )
190 dlg(new TextTag(arg1), arg2, textTagTable);
193 return consumed;
196 void delegate(TextTag, TextTagTable)[] onTagRemovedListeners;
197 void addOnTagRemoved(void delegate(TextTag, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
199 if ( !("tag-removed" in connectedSignals) )
201 Signals.connectData(
202 getStruct(),
203 "tag-removed",
204 cast(GCallback)&callBackTagRemoved,
205 cast(void*)this,
206 null,
207 connectFlags);
208 connectedSignals["tag-removed"] = 1;
210 onTagRemovedListeners ~= dlg;
212 extern(C) static void callBackTagRemoved(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable textTagTable)
214 bool consumed = false;
216 foreach ( void delegate(TextTag, TextTagTable) dlg ; textTagTable.onTagRemovedListeners )
218 dlg(new TextTag(arg1), textTagTable);
221 return consumed;
228 * Creates a new GtkTextTagTable. The table contains no tags by
229 * default.
230 * Returns:
231 * a new GtkTextTagTable
233 public static TextTagTable tableNew()
235 // GtkTextTagTable* gtk_text_tag_table_new (void);
236 return new TextTagTable( gtk_text_tag_table_new() );
240 * Add a tag to the table. The tag is assigned the highest priority
241 * in the table.
242 * tag must not be in a tag table already, and may not have
243 * the same name as an already-added tag.
244 * table:
245 * a GtkTextTagTable
246 * tag:
247 * a GtkTextTag
249 public void tableAdd(TextTag tag)
251 // void gtk_text_tag_table_add (GtkTextTagTable *table, GtkTextTag *tag);
252 gtk_text_tag_table_add(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
256 * Remove a tag from the table. This will remove the table's
257 * reference to the tag, so be careful - the tag will end
258 * up destroyed if you don't have a reference to it.
259 * table:
260 * a GtkTextTagTable
261 * tag:
262 * a GtkTextTag
264 public void tableRemove(TextTag tag)
266 // void gtk_text_tag_table_remove (GtkTextTagTable *table, GtkTextTag *tag);
267 gtk_text_tag_table_remove(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
271 * Look up a named tag.
272 * table:
273 * a GtkTextTagTable
274 * name:
275 * name of a tag
276 * Returns:
277 * The tag, or NULL if none by that name is in the table.
279 public TextTag tableLookup(char[] name)
281 // GtkTextTag* gtk_text_tag_table_lookup (GtkTextTagTable *table, const gchar *name);
282 return new TextTag( gtk_text_tag_table_lookup(gtkTextTagTable, Str.toStringz(name)) );
286 * Calls func on each tag in table, with user data data.
287 * Note that the table may not be modified while iterating
288 * over it (you can't add/remove tags).
289 * table:
290 * a GtkTextTagTable
291 * func:
292 * a function to call on each tag
293 * data:
294 * user data
296 public void tableForeach(GtkTextTagTableForeach func, void* data)
298 // void gtk_text_tag_table_foreach (GtkTextTagTable *table, GtkTextTagTableForeach func, gpointer data);
299 gtk_text_tag_table_foreach(gtkTextTagTable, func, data);
303 * Returns the size of the table (number of tags)
304 * table:
305 * a GtkTextTagTable
306 * Returns:
307 * number of tags in table
308 * Signal Details
309 * The "tag-added" signal
310 * void user_function (GtkTextTagTable *texttagtable,
311 * GtkTextTag *arg1,
312 * gpointer user_data) : Run Last
313 * texttagtable:
314 * the object which received the signal.
315 * arg1:
316 * user_data:
317 * user data set when the signal handler was connected.
319 public int tableGetSize()
321 // gint gtk_text_tag_table_get_size (GtkTextTagTable *table);
322 return gtk_text_tag_table_get_size(gtkTextTagTable);