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 change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegtk.TextTagTable;
26 27 privateimportglib.ConstructionException;
28 privateimportglib.Str;
29 privateimportgobject.ObjectG;
30 privateimportgobject.Signals;
31 privateimportgtk.BuildableIF;
32 privateimportgtk.BuildableT;
33 privateimportgtk.TextTag;
34 privateimportgtk.c.functions;
35 publicimportgtk.c.types;
36 privateimportstd.algorithm;
37 38 39 /**
40 * The collection of tags in a `GtkTextBuffer`
41 *
42 * You may wish to begin by reading the
43 * [text widget conceptual overview](section-text-widget.html),
44 * which gives an overview of all the objects and data types
45 * related to the text widget and how they work together.
46 *
47 * # GtkTextTagTables as GtkBuildable
48 *
49 * The `GtkTextTagTable` implementation of the `GtkBuildable` interface
50 * supports adding tags by specifying “tag” as the “type” attribute
51 * of a <child> element.
52 *
53 * An example of a UI definition fragment specifying tags:
54 * ```xml
55 * <object class="GtkTextTagTable">
56 * <child type="tag">
57 * <object class="GtkTextTag"/>
58 * </child>
59 * </object>
60 * ```
61 */62 publicclassTextTagTable : ObjectG, BuildableIF63 {
64 /** the main Gtk struct */65 protectedGtkTextTagTable* gtkTextTagTable;
66 67 /** Get the main Gtk struct */68 publicGtkTextTagTable* getTextTagTableStruct(booltransferOwnership = false)
69 {
70 if (transferOwnership)
71 ownedRef = false;
72 returngtkTextTagTable;
73 }
74 75 /** the main Gtk struct as a void* */76 protectedoverridevoid* getStruct()
77 {
78 returncast(void*)gtkTextTagTable;
79 }
80 81 /**
82 * Sets our main struct and passes it to the parent class.
83 */84 publicthis (GtkTextTagTable* gtkTextTagTable, boolownedRef = false)
85 {
86 this.gtkTextTagTable = gtkTextTagTable;
87 super(cast(GObject*)gtkTextTagTable, ownedRef);
88 }
89 90 // add the Buildable capabilities91 mixinBuildableT!(GtkTextTagTable);
92 93 94 /** */95 publicstaticGTypegetType()
96 {
97 returngtk_text_tag_table_get_type();
98 }
99 100 /**
101 * Creates a new `GtkTextTagTable`.
102 *
103 * The table contains no tags by default.
104 *
105 * Returns: a new `GtkTextTagTable`
106 *
107 * Throws: ConstructionException GTK+ fails to create the object.
108 */109 publicthis()
110 {
111 auto__p = gtk_text_tag_table_new();
112 113 if(__pisnull)
114 {
115 thrownewConstructionException("null returned by new");
116 }
117 118 this(cast(GtkTextTagTable*) __p, true);
119 }
120 121 /**
122 * Add a tag to the table.
123 *
124 * The tag is assigned the highest priority in the table.
125 *
126 * @tag must not be in a tag table already, and may not have
127 * the same name as an already-added tag.
128 *
129 * Params:
130 * tag = a `GtkTextTag`
131 *
132 * Returns: %TRUE on success.
133 */134 publicbooladd(TextTagtag)
135 {
136 returngtk_text_tag_table_add(gtkTextTagTable, (tagisnull) ? null : tag.getTextTagStruct()) != 0;
137 }
138 139 aliasforeac = foreach_;
140 /**
141 * Calls @func on each tag in @table, with user data @data.
142 *
143 * Note that the table may not be modified while iterating
144 * over it (you can’t add/remove tags).
145 *
146 * Params:
147 * func = a function to call on each tag
148 * data = user data
149 */150 publicvoidforeach_(GtkTextTagTableForeachfunc, void* data)
151 {
152 gtk_text_tag_table_foreach(gtkTextTagTable, func, data);
153 }
154 155 /**
156 * Returns the size of the table (number of tags)
157 *
158 * Returns: number of tags in @table
159 */160 publicintgetSize()
161 {
162 returngtk_text_tag_table_get_size(gtkTextTagTable);
163 }
164 165 /**
166 * Look up a named tag.
167 *
168 * Params:
169 * name = name of a tag
170 *
171 * Returns: The tag,
172 * or %NULL if none by that name is in the table.
173 */174 publicTextTaglookup(stringname)
175 {
176 auto__p = gtk_text_tag_table_lookup(gtkTextTagTable, Str.toStringz(name));
177 178 if(__pisnull)
179 {
180 returnnull;
181 }
182 183 returnObjectG.getDObject!(TextTag)(cast(GtkTextTag*) __p);
184 }
185 186 /**
187 * Remove a tag from the table.
188 *
189 * If a `GtkTextBuffer` has @table as its tag table, the tag is
190 * removed from the buffer. The table’s reference to the tag is
191 * removed, so the tag will end up destroyed if you don’t have
192 * a reference to it.
193 *
194 * Params:
195 * tag = a `GtkTextTag`
196 */197 publicvoidremove(TextTagtag)
198 {
199 gtk_text_tag_table_remove(gtkTextTagTable, (tagisnull) ? null : tag.getTextTagStruct());
200 }
201 202 /**
203 * Emitted every time a new tag is added in the `GtkTextTagTable`.
204 *
205 * Params:
206 * tag = the added tag.
207 */208 gulongaddOnTagAdded(voiddelegate(TextTag, TextTagTable) dlg, ConnectFlagsconnectFlags=cast(ConnectFlags)0)
209 {
210 returnSignals.connect(this, "tag-added", dlg, connectFlags ^ ConnectFlags.SWAPPED);
211 }
212 213 /**
214 * Emitted every time a tag in the `GtkTextTagTable` changes.
215 *
216 * Params:
217 * tag = the changed tag.
218 * sizeChanged = whether the change affects the `GtkTextView` layout.
219 */220 gulongaddOnTagChanged(voiddelegate(TextTag, bool, TextTagTable) dlg, ConnectFlagsconnectFlags=cast(ConnectFlags)0)
221 {
222 returnSignals.connect(this, "tag-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
223 }
224 225 /**
226 * Emitted every time a tag is removed from the `GtkTextTagTable`.
227 *
228 * The @tag is still valid by the time the signal is emitted, but
229 * it is not associated with a tag table any more.
230 *
231 * Params:
232 * tag = the removed tag.
233 */234 gulongaddOnTagRemoved(voiddelegate(TextTag, TextTagTable) dlg, ConnectFlagsconnectFlags=cast(ConnectFlags)0)
235 {
236 returnSignals.connect(this, "tag-removed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
237 }
238 }