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  = GtkTextTagTable.html
27  * outPack = gtk
28  * outFile = TextTagTable
29  * strct   = GtkTextTagTable
30  * realStrct=
31  * ctorStrct=
32  * clss    = TextTagTable
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_text_tag_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtk.TextTag
49  * structWrap:
50  * 	- GtkTextTag* -> TextTag
51  * 	- GtkTextTagTable* -> TextTagTable
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gtk.TextTagTable;
58 
59 public  import gtkc.gtktypes;
60 
61 private import gtkc.gtk;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 private import gobject.Signals;
66 public  import gtkc.gdktypes;
67 
68 private import glib.Str;
69 private import gtk.TextTag;
70 
71 
72 
73 private import gobject.ObjectG;
74 
75 /**
76  * Description
77  * You may wish to begin by reading the text widget
78  * conceptual overview which gives an overview of all the objects and data
79  * types related to the text widget and how they work together.
80  * GtkTextTagTables as GtkBuildable
81  * The GtkTextTagTable implementation of the GtkBuildable interface
82  * supports adding tags by specifying "tag" as the "type"
83  * attribute of a <child> element.
84  * $(DDOC_COMMENT example)
85  * You may wish to begin by reading the text widget
86  * conceptual overview which gives an overview of all the objects and data
87  * types related to the text widget and how they work together.
88  */
89 public class TextTagTable : ObjectG
90 {
91 	
92 	/** the main Gtk struct */
93 	protected GtkTextTagTable* gtkTextTagTable;
94 	
95 	
96 	public GtkTextTagTable* getTextTagTableStruct()
97 	{
98 		return gtkTextTagTable;
99 	}
100 	
101 	
102 	/** the main Gtk struct as a void* */
103 	protected override void* getStruct()
104 	{
105 		return cast(void*)gtkTextTagTable;
106 	}
107 	
108 	/**
109 	 * Sets our main struct and passes it to the parent class
110 	 */
111 	public this (GtkTextTagTable* gtkTextTagTable)
112 	{
113 		super(cast(GObject*)gtkTextTagTable);
114 		this.gtkTextTagTable = gtkTextTagTable;
115 	}
116 	
117 	protected override void setStruct(GObject* obj)
118 	{
119 		super.setStruct(obj);
120 		gtkTextTagTable = cast(GtkTextTagTable*)obj;
121 	}
122 	
123 	/**
124 	 */
125 	int[string] connectedSignals;
126 	
127 	void delegate(TextTag, TextTagTable)[] onTagAddedListeners;
128 	/**
129 	 */
130 	void addOnTagAdded(void delegate(TextTag, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
131 	{
132 		if ( !("tag-added" in connectedSignals) )
133 		{
134 			Signals.connectData(
135 			getStruct(),
136 			"tag-added",
137 			cast(GCallback)&callBackTagAdded,
138 			cast(void*)this,
139 			null,
140 			connectFlags);
141 			connectedSignals["tag-added"] = 1;
142 		}
143 		onTagAddedListeners ~= dlg;
144 	}
145 	extern(C) static void callBackTagAdded(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable _textTagTable)
146 	{
147 		foreach ( void delegate(TextTag, TextTagTable) dlg ; _textTagTable.onTagAddedListeners )
148 		{
149 			dlg(ObjectG.getDObject!(TextTag)(arg1), _textTagTable);
150 		}
151 	}
152 	
153 	void delegate(TextTag, gboolean, TextTagTable)[] onTagChangedListeners;
154 	/**
155 	 */
156 	void addOnTagChanged(void delegate(TextTag, gboolean, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
157 	{
158 		if ( !("tag-changed" in connectedSignals) )
159 		{
160 			Signals.connectData(
161 			getStruct(),
162 			"tag-changed",
163 			cast(GCallback)&callBackTagChanged,
164 			cast(void*)this,
165 			null,
166 			connectFlags);
167 			connectedSignals["tag-changed"] = 1;
168 		}
169 		onTagChangedListeners ~= dlg;
170 	}
171 	extern(C) static void callBackTagChanged(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, gboolean arg2, TextTagTable _textTagTable)
172 	{
173 		foreach ( void delegate(TextTag, gboolean, TextTagTable) dlg ; _textTagTable.onTagChangedListeners )
174 		{
175 			dlg(ObjectG.getDObject!(TextTag)(arg1), arg2, _textTagTable);
176 		}
177 	}
178 	
179 	void delegate(TextTag, TextTagTable)[] onTagRemovedListeners;
180 	/**
181 	 */
182 	void addOnTagRemoved(void delegate(TextTag, TextTagTable) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
183 	{
184 		if ( !("tag-removed" in connectedSignals) )
185 		{
186 			Signals.connectData(
187 			getStruct(),
188 			"tag-removed",
189 			cast(GCallback)&callBackTagRemoved,
190 			cast(void*)this,
191 			null,
192 			connectFlags);
193 			connectedSignals["tag-removed"] = 1;
194 		}
195 		onTagRemovedListeners ~= dlg;
196 	}
197 	extern(C) static void callBackTagRemoved(GtkTextTagTable* texttagtableStruct, GtkTextTag* arg1, TextTagTable _textTagTable)
198 	{
199 		foreach ( void delegate(TextTag, TextTagTable) dlg ; _textTagTable.onTagRemovedListeners )
200 		{
201 			dlg(ObjectG.getDObject!(TextTag)(arg1), _textTagTable);
202 		}
203 	}
204 	
205 	
206 	/**
207 	 * Creates a new GtkTextTagTable. The table contains no tags by
208 	 * default.
209 	 * Returns: a new GtkTextTagTable
210 	 */
211 	public static TextTagTable tableNew()
212 	{
213 		// GtkTextTagTable * gtk_text_tag_table_new (void);
214 		auto p = gtk_text_tag_table_new();
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return ObjectG.getDObject!(TextTagTable)(cast(GtkTextTagTable*) p);
222 	}
223 	
224 	/**
225 	 * Add a tag to the table. The tag is assigned the highest priority
226 	 * in the table.
227 	 * tag must not be in a tag table already, and may not have
228 	 * the same name as an already-added tag.
229 	 * Params:
230 	 * table = a GtkTextTagTable
231 	 * tag = a GtkTextTag
232 	 */
233 	public void tableAdd(TextTag tag)
234 	{
235 		// void gtk_text_tag_table_add (GtkTextTagTable *table,  GtkTextTag *tag);
236 		gtk_text_tag_table_add(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
237 	}
238 	
239 	/**
240 	 * Remove a tag from the table. This will remove the table's
241 	 * reference to the tag, so be careful - the tag will end
242 	 * up destroyed if you don't have a reference to it.
243 	 * Params:
244 	 * table = a GtkTextTagTable
245 	 * tag = a GtkTextTag
246 	 */
247 	public void tableRemove(TextTag tag)
248 	{
249 		// void gtk_text_tag_table_remove (GtkTextTagTable *table,  GtkTextTag *tag);
250 		gtk_text_tag_table_remove(gtkTextTagTable, (tag is null) ? null : tag.getTextTagStruct());
251 	}
252 	
253 	/**
254 	 * Look up a named tag.
255 	 * Params:
256 	 * table = a GtkTextTagTable
257 	 * name = name of a tag
258 	 * Returns: The tag, or NULL if none by that name is in the table. [transfer none]
259 	 */
260 	public TextTag tableLookup(string name)
261 	{
262 		// GtkTextTag * gtk_text_tag_table_lookup (GtkTextTagTable *table,  const gchar *name);
263 		auto p = gtk_text_tag_table_lookup(gtkTextTagTable, Str.toStringz(name));
264 		
265 		if(p is null)
266 		{
267 			return null;
268 		}
269 		
270 		return ObjectG.getDObject!(TextTag)(cast(GtkTextTag*) p);
271 	}
272 	
273 	/**
274 	 * Calls func on each tag in table, with user data data.
275 	 * Note that the table may not be modified while iterating
276 	 * over it (you can't add/remove tags).
277 	 * Params:
278 	 * table = a GtkTextTagTable
279 	 * func = a function to call on each tag. [scope call]
280 	 * data = user data
281 	 */
282 	public void tableForeach(GtkTextTagTableForeach func, void* data)
283 	{
284 		// void gtk_text_tag_table_foreach (GtkTextTagTable *table,  GtkTextTagTableForeach func,  gpointer data);
285 		gtk_text_tag_table_foreach(gtkTextTagTable, func, data);
286 	}
287 	
288 	/**
289 	 * Returns the size of the table (number of tags)
290 	 * Params:
291 	 * table = a GtkTextTagTable
292 	 * Returns: number of tags in table Signal Details The "tag-added" signal void user_function (GtkTextTagTable *texttagtable, GtkTextTag *arg1, gpointer user_data) : Run Last
293 	 */
294 	public int tableGetSize()
295 	{
296 		// gint gtk_text_tag_table_get_size (GtkTextTagTable *table);
297 		return gtk_text_tag_table_get_size(gtkTextTagTable);
298 	}
299 }