alternative to assert
[gtkD.git] / src / gtk / TextTag.d
blob4073df0480c4e58819c84d0fa0219eca0f5b8634
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 = 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 * local aliases:
57 module gtk.TextTag;
59 private import gtk.gtktypes;
61 private import lib.gtk;
63 private import glib.Str;
64 private import gobject.ObjectG;
65 private import gdk.Event;
66 private import gtk.TextIter;
68 /**
69 * Description
70 * You may wish to begin by reading the text widget
71 * conceptual overview which gives an overview of all the objects and data
72 * types related to the text widget and how they work together.
73 * Tags should be in the GtkTextTagTable for a given GtkTextBuffer
74 * before using them with that buffer.
75 * gtk_text_buffer_create_tag() is the best way to create tags.
76 * See gtk-demo for numerous examples.
77 * The "invisible" property was not implemented for GTK+ 2.0; it's
78 * planned to be implemented in future releases.
80 private import gobject.ObjectG;
81 public class TextTag : ObjectG
84 /** the main Gtk struct */
85 protected GtkTextTag* gtkTextTag;
88 public GtkTextTag* getTextTagStruct()
90 return gtkTextTag;
94 /** the main Gtk struct as a void* */
95 protected void* getStruct()
97 return cast(void*)gtkTextTag;
101 * Sets our main struct and passes it to the parent class
103 public this (GtkTextTag* gtkTextTag)
105 super(cast(GObject*)gtkTextTag);
106 this.gtkTextTag = gtkTextTag;
112 // imports for the signal processing
113 private import gobject.Signals;
114 private import gdk.gdktypes;
115 int[char[]] connectedSignals;
117 gboolean delegate(ObjectG, Event, TextIter, TextTag)[] onListeners;
118 void addOn(gboolean delegate(ObjectG, Event, TextIter, TextTag) dlg)
120 if ( !("event" in connectedSignals) )
122 Signals.connectData(
123 getStruct(),
124 "event",
125 cast(GCallback)&callBack,
126 this,
127 null,
128 cast(ConnectFlags)0);
129 connectedSignals["event"] = 1;
131 onListeners ~= dlg;
133 extern(C) static void callBack(GtkTextTag* texttagStruct, GObject* arg1, GdkEvent* event, GtkTextIter* arg2, TextTag textTag)
135 bit consumed = false;
137 foreach ( gboolean delegate(ObjectG, Event, TextIter, TextTag) dlg ; textTag.onListeners )
139 dlg(new ObjectG(arg1), new Event(event), new TextIter(arg2), textTag);
142 return consumed;
150 * Creates a GtkTextTag. Configure the tag using object arguments,
151 * i.e. using g_object_set().
152 * name:
153 * tag name, or NULL
154 * Returns:
155 * a new GtkTextTag
157 public this (char[] name)
159 // GtkTextTag* gtk_text_tag_new (const gchar *name);
160 this(cast(GtkTextTag*)gtk_text_tag_new(Str.toStringz(name)) );
164 * Get the tag priority.
165 * tag:
166 * a GtkTextTag
167 * Returns:
168 * The tag's priority.
170 public int getPriority()
172 // gint gtk_text_tag_get_priority (GtkTextTag *tag);
173 return gtk_text_tag_get_priority(gtkTextTag);
177 * Sets the priority of a GtkTextTag. Valid priorities are
178 * start at 0 and go to one less than gtk_text_tag_table_get_size().
179 * Each tag in a table has a unique priority; setting the priority
180 * of one tag shifts the priorities of all the other tags in the
181 * table to maintain a unique priority for each tag. Higher priority
182 * tags "win" if two tags both set the same text attribute. When adding
183 * a tag to a tag table, it will be assigned the highest priority in
184 * the table by default; so normally the precedence of a set of tags
185 * is the order in which they were added to the table, or created with
186 * gtk_text_buffer_create_tag(), which adds the tag to the buffer's table
187 * automatically.
188 * tag:
189 * a GtkTextTag
190 * priority:
191 * the new priority
193 public void setPriority(int priority)
195 // void gtk_text_tag_set_priority (GtkTextTag *tag, gint priority);
196 gtk_text_tag_set_priority(gtkTextTag, priority);
200 * Emits the "event" signal on the GtkTextTag.
201 * tag:
202 * a GtkTextTag
203 * event_object:
204 * object that received the event, such as a widget
205 * event:
206 * the event
207 * iter:
208 * location where the event was received
209 * Returns:
210 * result of signal emission (whether the event was handled)
212 public int event(ObjectG eventObject, Event event, TextIter iter)
214 // gboolean gtk_text_tag_event (GtkTextTag *tag, GObject *event_object, GdkEvent *event, const GtkTextIter *iter);
215 return gtk_text_tag_event(gtkTextTag, (eventObject is null) ? null : eventObject.getObjectGStruct(), (event is null) ? null : event.getEventStruct(), (iter is null) ? null : iter.getTextIterStruct());