alternative to assert
[gtkD.git] / gtkD / src / gtk / TextTag.d
blobfa8d18740a3f996aa38595f9e5ce15e822f5400a
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 = GtkTextTag.html
26 * outPack = gtk
27 * outFile = TextTag
28 * strct = GtkTextTag
29 * realStrct=
30 * ctorStrct=
31 * clss = TextTag
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 * - gtk_text_attributes_
44 * omit code:
45 * imports:
46 * - glib.Str
47 * - gobject.ObjectG
48 * - gdk.Event
49 * - gtk.TextIter
50 * structWrap:
51 * - GObject* -> ObjectG
52 * - GdkEvent* -> Event
53 * - GtkTextIter* -> TextIter
54 * module aliases:
55 * local aliases:
58 module gtk.TextTag;
60 version(noAssert)
62 version(Tango)
64 import tango.io.Stdout; // use the tango loging?
68 private import gtkc.gtktypes;
70 private import gtkc.gtk;
73 private import glib.Str;
74 private import gobject.ObjectG;
75 private import gdk.Event;
76 private import gtk.TextIter;
81 /**
82 * Description
83 * You may wish to begin by reading the text widget
84 * conceptual overview which gives an overview of all the objects and data
85 * types related to the text widget and how they work together.
86 * Tags should be in the GtkTextTagTable for a given GtkTextBuffer
87 * before using them with that buffer.
88 * gtk_text_buffer_create_tag() is the best way to create tags.
89 * See gtk-demo for numerous examples.
90 * The "invisible" property was not implemented for GTK+ 2.0; it's
91 * planned to be implemented in future releases.
93 private import gobject.ObjectG;
94 public class TextTag : ObjectG
97 /** the main Gtk struct */
98 protected GtkTextTag* gtkTextTag;
101 public GtkTextTag* getTextTagStruct()
103 return gtkTextTag;
107 /** the main Gtk struct as a void* */
108 protected void* getStruct()
110 return cast(void*)gtkTextTag;
114 * Sets our main struct and passes it to the parent class
116 public this (GtkTextTag* gtkTextTag)
118 version(noAssert)
120 if ( gtkTextTag is null )
122 int zero = 0;
123 version(Tango)
125 Stdout("struct gtkTextTag is null on constructor").newline;
127 else
129 printf("struct gtkTextTag is null on constructor");
131 zero = zero / zero;
134 else
136 assert(gtkTextTag !is null, "struct gtkTextTag is null on constructor");
138 super(cast(GObject*)gtkTextTag);
139 this.gtkTextTag = gtkTextTag;
145 // imports for the signal processing
146 private import gobject.Signals;
147 private import gtkc.gdktypes;
148 int[char[]] connectedSignals;
150 gboolean delegate(ObjectG, Event, TextIter, TextTag)[] onListeners;
151 void addOn(gboolean delegate(ObjectG, Event, TextIter, TextTag) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
153 if ( !("event" in connectedSignals) )
155 Signals.connectData(
156 getStruct(),
157 "event",
158 cast(GCallback)&callBack,
159 cast(void*)this,
160 null,
161 connectFlags);
162 connectedSignals["event"] = 1;
164 onListeners ~= dlg;
166 extern(C) static void callBack(GtkTextTag* texttagStruct, GObject* arg1, GdkEvent* event, GtkTextIter* arg2, TextTag textTag)
168 bool consumed = false;
170 foreach ( gboolean delegate(ObjectG, Event, TextIter, TextTag) dlg ; textTag.onListeners )
172 dlg(new ObjectG(arg1), new Event(event), new TextIter(arg2), textTag);
175 return consumed;
183 * Creates a GtkTextTag. Configure the tag using object arguments,
184 * i.e. using g_object_set().
185 * name:
186 * tag name, or NULL
187 * Returns:
188 * a new GtkTextTag
190 public this (char[] name)
192 // GtkTextTag* gtk_text_tag_new (const gchar *name);
193 this(cast(GtkTextTag*)gtk_text_tag_new(Str.toStringz(name)) );
197 * Get the tag priority.
198 * tag:
199 * a GtkTextTag
200 * Returns:
201 * The tag's priority.
203 public int getPriority()
205 // gint gtk_text_tag_get_priority (GtkTextTag *tag);
206 return gtk_text_tag_get_priority(gtkTextTag);
210 * Sets the priority of a GtkTextTag. Valid priorities are
211 * start at 0 and go to one less than gtk_text_tag_table_get_size().
212 * Each tag in a table has a unique priority; setting the priority
213 * of one tag shifts the priorities of all the other tags in the
214 * table to maintain a unique priority for each tag. Higher priority
215 * tags "win" if two tags both set the same text attribute. When adding
216 * a tag to a tag table, it will be assigned the highest priority in
217 * the table by default; so normally the precedence of a set of tags
218 * is the order in which they were added to the table, or created with
219 * gtk_text_buffer_create_tag(), which adds the tag to the buffer's table
220 * automatically.
221 * tag:
222 * a GtkTextTag
223 * priority:
224 * the new priority
226 public void setPriority(int priority)
228 // void gtk_text_tag_set_priority (GtkTextTag *tag, gint priority);
229 gtk_text_tag_set_priority(gtkTextTag, priority);
233 * Emits the "event" signal on the GtkTextTag.
234 * tag:
235 * a GtkTextTag
236 * event_object:
237 * object that received the event, such as a widget
238 * event:
239 * the event
240 * iter:
241 * location where the event was received
242 * Returns:
243 * result of signal emission (whether the event was handled)
245 public int event(ObjectG eventObject, Event event, TextIter iter)
247 // gboolean gtk_text_tag_event (GtkTextTag *tag, GObject *event_object, GdkEvent *event, const GtkTextIter *iter);
248 return gtk_text_tag_event(gtkTextTag, (eventObject is null) ? null : eventObject.getObjectGStruct(), (event is null) ? null : event.getEventStruct(), (iter is null) ? null : iter.getTextIterStruct());