alternative to assert
[gtkD.git] / src / gtk / TextTagTable.d
blob0c04bbda24e720a5714354ebada9d8dc01c28ef0
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
54 module gtk.TextTagTable;
56 private import gtk.gtktypes;
58 private import lib.gtk;
60 private import glib.Str;
61 private import gtk.TextTagTable;
62 private import gtk.TextTag;
64 /**
65 * Description
66 * You may wish to begin by reading the text widget
67 * conceptual overview which gives an overview of all the objects and data
68 * types related to the text widget and how they work together.
70 private import gobject.ObjectG;
71 public class TextTagTable : ObjectG
74 /** the main Gtk struct */
75 protected GtkTextTagTable* gtkTextTagTable;
78 public GtkTextTagTable* getTextTagTableStruct()
80 return gtkTextTagTable;
84 /** the main Gtk struct as a void* */
85 protected void* getStruct()
87 return cast(void*)gtkTextTagTable;
90 /**
91 * Sets our main struct and passes it to the parent class
93 public this (GtkTextTagTable* gtkTextTagTable)
95 super(cast(GObject*)gtkTextTagTable);
96 this.gtkTextTagTable = gtkTextTagTable;
99 /**
102 // imports for the signal processing
103 private import gobject.Signals;
104 private import gdk.gdktypes;
105 int[char[]] connectedSignals;
107 void delegate(TextTag, TextTagTable)[] onTagAddedListeners;
108 void addOnTagAdded(void delegate(TextTag, TextTagTable) dlg)
110 if ( !("tag-added" in connectedSignals) )
112 Signals.connectData(
113 getStruct(),
114 "tag-added",
115 cast(GCallback)&callBackTagAdded,
116 this,
117 null,
118 cast(ConnectFlags)0);
119 connectedSignals["tag-added"] = 1;
121 onTagAddedListeners ~= dlg;
123 extern(C) static void callBackTagAdded(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable textTagTable)
125 bit consumed = false;
127 foreach ( void delegate(TextTag, TextTagTable) dlg ; textTagTable.onTagAddedListeners )
129 dlg(new TextTag(arg1), textTagTable);
132 return consumed;
135 void delegate(TextTag, gboolean, TextTagTable)[] onTagChangedListeners;
136 void addOnTagChanged(void delegate(TextTag, gboolean, TextTagTable) dlg)
138 if ( !("tag-changed" in connectedSignals) )
140 Signals.connectData(
141 getStruct(),
142 "tag-changed",
143 cast(GCallback)&callBackTagChanged,
144 this,
145 null,
146 cast(ConnectFlags)0);
147 connectedSignals["tag-changed"] = 1;
149 onTagChangedListeners ~= dlg;
151 extern(C) static void callBackTagChanged(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, gboolean arg2, TextTagTable textTagTable)
153 bit consumed = false;
155 foreach ( void delegate(TextTag, gboolean, TextTagTable) dlg ; textTagTable.onTagChangedListeners )
157 dlg(new TextTag(arg1), arg2, textTagTable);
160 return consumed;
163 void delegate(TextTag, TextTagTable)[] onTagRemovedListeners;
164 void addOnTagRemoved(void delegate(TextTag, TextTagTable) dlg)
166 if ( !("tag-removed" in connectedSignals) )
168 Signals.connectData(
169 getStruct(),
170 "tag-removed",
171 cast(GCallback)&callBackTagRemoved,
172 this,
173 null,
174 cast(ConnectFlags)0);
175 connectedSignals["tag-removed"] = 1;
177 onTagRemovedListeners ~= dlg;
179 extern(C) static void callBackTagRemoved(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable textTagTable)
181 bit consumed = false;
183 foreach ( void delegate(TextTag, TextTagTable) dlg ; textTagTable.onTagRemovedListeners )
185 dlg(new TextTag(arg1), textTagTable);
188 return consumed;
195 * Creates a new GtkTextTagTable. The table contains no tags by
196 * default.
197 * Returns:
198 * a new GtkTextTagTable
200 public static TextTagTable tableNew()
202 // GtkTextTagTable* gtk_text_tag_table_new (void);
203 return new TextTagTable( gtk_text_tag_table_new() );
207 * Add a tag to the table. The tag is assigned the highest priority
208 * in the table.
209 * tag must not be in a tag table already, and may not have
210 * the same name as an already-added tag.
211 * table:
212 * a GtkTextTagTable
213 * tag:
214 * a GtkTextTag
216 public void tableAdd(TextTag tag)
218 // void gtk_text_tag_table_add (GtkTextTagTable *table, GtkTextTag *tag);
219 gtk_text_tag_table_add(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
223 * Remove a tag from the table. This will remove the table's
224 * reference to the tag, so be careful - the tag will end
225 * up destroyed if you don't have a reference to it.
226 * table:
227 * a GtkTextTagTable
228 * tag:
229 * a GtkTextTag
231 public void tableRemove(TextTag tag)
233 // void gtk_text_tag_table_remove (GtkTextTagTable *table, GtkTextTag *tag);
234 gtk_text_tag_table_remove(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
238 * Look up a named tag.
239 * table:
240 * a GtkTextTagTable
241 * name:
242 * name of a tag
243 * Returns:
244 * The tag, or NULL if none by that name is in the table.
246 public TextTag tableLookup(char[] name)
248 // GtkTextTag* gtk_text_tag_table_lookup (GtkTextTagTable *table, const gchar *name);
249 return new TextTag( gtk_text_tag_table_lookup(gtkTextTagTable, Str.toStringz(name)) );
253 * Calls func on each tag in table, with user data data.
254 * Note that the table may not be modified while iterating
255 * over it (you can't add/remove tags).
256 * table:
257 * a GtkTextTagTable
258 * func:
259 * a function to call on each tag
260 * data:
261 * user data
263 public void tableForeach(GtkTextTagTableForeach func, void* data)
265 // void gtk_text_tag_table_foreach (GtkTextTagTable *table, GtkTextTagTableForeach func, gpointer data);
266 gtk_text_tag_table_foreach(gtkTextTagTable, func, data);
270 * Returns the size of the table (number of tags)
271 * table:
272 * a GtkTextTagTable
273 * Returns:
274 * number of tags in table
275 * Signal Details
276 * The "tag-added" signal
277 * void user_function (GtkTextTagTable *texttagtable,
278 * GtkTextTag *arg1,
279 * gpointer user_data) : Run last
280 * texttagtable:
281 * the object which received the signal.
282 * arg1:
283 * user_data:
284 * user data set when the signal handler was connected.
286 public int tableGetSize()
288 // gint gtk_text_tag_table_get_size (GtkTextTagTable *table);
289 return gtk_text_tag_table_get_size(gtkTextTagTable);