alternative to assert
[gtkD.git] / gtkD / src / gtk / TextAttributes.d
blob43e9f349af3943a8db68a0f5b8ecaa7c205148d0
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 =
26 * outPack = gtk
27 * outFile = TextAttributes
28 * strct = GtkTextAttributes
29 * realStrct=
30 * ctorStrct=
31 * clss = TextAttributes
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_text_attributes_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gtk.TextAttributes
45 * structWrap:
46 * - GtkTextAttributes* -> TextAttributes
47 * module aliases:
48 * local aliases:
51 module gtk.TextAttributes;
53 version(noAssert)
55 version(Tango)
57 import tango.io.Stdout; // use the tango loging?
61 private import gtkc.gtktypes;
63 private import gtkc.gtk;
66 private import gtk.TextAttributes;
71 /**
72 * Description
73 * You may wish to begin by reading the text widget
74 * conceptual overview which gives an overview of all the objects and data
75 * types related to the text widget and how they work together.
76 * Tags should be in the GtkTextTagTable for a given GtkTextBuffer
77 * before using them with that buffer.
78 * gtk_text_buffer_create_tag() is the best way to create tags.
79 * See gtk-demo for numerous examples.
80 * The "invisible" property was not implemented for GTK+ 2.0; it's
81 * planned to be implemented in future releases.
83 public class TextAttributes
86 /** the main Gtk struct */
87 protected GtkTextAttributes* gtkTextAttributes;
90 public GtkTextAttributes* getTextAttributesStruct()
92 return gtkTextAttributes;
96 /** the main Gtk struct as a void* */
97 protected void* getStruct()
99 return cast(void*)gtkTextAttributes;
103 * Sets our main struct and passes it to the parent class
105 public this (GtkTextAttributes* gtkTextAttributes)
107 version(noAssert)
109 if ( gtkTextAttributes is null )
111 int zero = 0;
112 version(Tango)
114 Stdout("struct gtkTextAttributes is null on constructor").newline;
116 else
118 printf("struct gtkTextAttributes is null on constructor");
120 zero = zero / zero;
123 else
125 assert(gtkTextAttributes !is null, "struct gtkTextAttributes is null on constructor");
127 this.gtkTextAttributes = gtkTextAttributes;
133 // imports for the signal processing
134 private import gobject.Signals;
135 private import gtkc.gdktypes;
136 int[char[]] connectedSignals;
138 gboolean delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes)[] onListeners;
139 void addOn(gboolean delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
141 if ( !("event" in connectedSignals) )
143 Signals.connectData(
144 getStruct(),
145 "event",
146 cast(GCallback)&callBack,
147 cast(void*)this,
148 null,
149 connectFlags);
150 connectedSignals["event"] = 1;
152 onListeners ~= dlg;
154 extern(C) static void callBack(GtkTextTag* texttagStruct, GObject* arg1, GdkEvent* event, GtkTextIter* arg2, TextAttributes textAttributes)
156 bool consumed = false;
158 foreach ( gboolean delegate(GObject*, GdkEvent*, GtkTextIter*, TextAttributes) dlg ; textAttributes.onListeners )
160 dlg(arg1, event, arg2, textAttributes);
163 return consumed;
176 * Creates a GtkTextAttributes, which describes
177 * a set of properties on some text.
178 * Returns:
179 * a new GtkTextAttributes
181 public this ()
183 // GtkTextAttributes* gtk_text_attributes_new (void);
184 this(cast(GtkTextAttributes*)gtk_text_attributes_new() );
188 * Copies src and returns a new GtkTextAttributes.
189 * src:
190 * a GtkTextAttributes to be copied
191 * Returns:
192 * a copy of src
194 public TextAttributes copy()
196 // GtkTextAttributes* gtk_text_attributes_copy (GtkTextAttributes *src);
197 return new TextAttributes( gtk_text_attributes_copy(gtkTextAttributes) );
201 * Copies the values from src to dest so that dest has the same values
202 * as src. Frees existing values in dest.
203 * src:
204 * a GtkTextAttributes
205 * dest:
206 * another GtkTextAttributes
208 public void copyValues(TextAttributes dest)
210 // void gtk_text_attributes_copy_values (GtkTextAttributes *src, GtkTextAttributes *dest);
211 gtk_text_attributes_copy_values(gtkTextAttributes, (dest is null) ? null : dest.getTextAttributesStruct());
215 * Decrements the reference count on values, freeing the structure
216 * if the reference count reaches 0.
217 * values:
218 * a GtkTextAttributes
220 public void unref()
222 // void gtk_text_attributes_unref (GtkTextAttributes *values);
223 gtk_text_attributes_unref(gtkTextAttributes);
227 * Increments the reference count on values.
228 * values:
229 * a GtkTextAttributes
230 * Returns:
231 * the GtkTextAttributes that were passed in
232 * Property Details
233 * The "background" property
234 * "background" gchararray : Write
235 * Background color as a string.
236 * Default value: NULL
238 public TextAttributes doref()
240 // GtkTextAttributes* gtk_text_attributes_ref (GtkTextAttributes *values);
241 return new TextAttributes( gtk_text_attributes_ref(gtkTextAttributes) );