alternative to assert
[gtkD.git] / gtkD / src / gtk / TextMark.d
blob391abb1daab02590f65871f4d4019a3925717705
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 = GtkTextMark.html
26 * outPack = gtk
27 * outFile = TextMark
28 * strct = GtkTextMark
29 * realStrct=
30 * ctorStrct=
31 * clss = TextMark
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_text_mark_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.TextBuffer
47 * structWrap:
48 * - GtkTextBuffer* -> TextBuffer
49 * module aliases:
50 * local aliases:
53 module gtk.TextMark;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gtktypes;
65 private import gtkc.gtk;
68 private import glib.Str;
69 private import gtk.TextBuffer;
74 /**
75 * Description
76 * You may wish to begin by reading the text widget
77 * conceptual overview which gives an overview of all the objects and data
78 * types related to the text widget and how they work together.
79 * A GtkTextMark is like a bookmark in a text buffer; it preserves a position in
80 * the text. You can convert the mark to an iterator using
81 * gtk_text_buffer_get_iter_at_mark(). Unlike iterators, marks remain valid across
82 * buffer mutations, because their behavior is defined when text is inserted or
83 * deleted. When text containing a mark is deleted, the mark remains in the
84 * position originally occupied by the deleted text. When text is inserted at a
85 * mark, a mark with left gravity will be moved to the
86 * beginning of the newly-inserted text, and a mark with right
87 * gravity will be moved to the end.
88 * [3]
89 * Marks are reference counted, but the reference count only controls the validity
90 * of the memory; marks can be deleted from the buffer at any time with
91 * gtk_text_buffer_delete_mark(). Once deleted from the buffer, a mark is
92 * essentially useless.
93 * Marks optionally have names; these can be convenient to avoid passing the
94 * GtkTextMark object around.
95 * Marks are typically created using the gtk_text_buffer_create_mark() function.
97 private import gobject.ObjectG;
98 public class TextMark : ObjectG
101 /** the main Gtk struct */
102 protected GtkTextMark* gtkTextMark;
105 public GtkTextMark* getTextMarkStruct()
107 return gtkTextMark;
111 /** the main Gtk struct as a void* */
112 protected void* getStruct()
114 return cast(void*)gtkTextMark;
118 * Sets our main struct and passes it to the parent class
120 public this (GtkTextMark* gtkTextMark)
122 version(noAssert)
124 if ( gtkTextMark is null )
126 int zero = 0;
127 version(Tango)
129 Stdout("struct gtkTextMark is null on constructor").newline;
131 else
133 printf("struct gtkTextMark is null on constructor");
135 zero = zero / zero;
138 else
140 assert(gtkTextMark !is null, "struct gtkTextMark is null on constructor");
142 super(cast(GObject*)gtkTextMark);
143 this.gtkTextMark = gtkTextMark;
151 * Sets the visibility of mark; the insertion point is normally
152 * visible, i.e. you can see it as a vertical bar. Also, the text
153 * widget uses a visible mark to indicate where a drop will occur when
154 * dragging-and-dropping text. Most other marks are not visible.
155 * Marks are not visible by default.
156 * mark:
157 * a GtkTextMark
158 * setting:
159 * visibility of mark
161 public void setVisible(int setting)
163 // void gtk_text_mark_set_visible (GtkTextMark *mark, gboolean setting);
164 gtk_text_mark_set_visible(gtkTextMark, setting);
168 * Returns TRUE if the mark is visible (i.e. a cursor is displayed
169 * for it)
170 * mark:
171 * a GtkTextMark
172 * Returns:
173 * TRUE if visible
175 public int getVisible()
177 // gboolean gtk_text_mark_get_visible (GtkTextMark *mark);
178 return gtk_text_mark_get_visible(gtkTextMark);
182 * Returns TRUE if the mark has been removed from its buffer
183 * with gtk_text_buffer_delete_mark(). Marks can't be used
184 * once deleted.
185 * mark:
186 * a GtkTextMark
187 * Returns:
188 * whether the mark is deleted
190 public int getDeleted()
192 // gboolean gtk_text_mark_get_deleted (GtkTextMark *mark);
193 return gtk_text_mark_get_deleted(gtkTextMark);
197 * Returns the mark name; returns NULL for anonymous marks.
198 * mark:
199 * a GtkTextMark
200 * Returns:
201 * mark name
203 public char[] getName()
205 // const gchar* gtk_text_mark_get_name (GtkTextMark *mark);
206 return Str.toString(gtk_text_mark_get_name(gtkTextMark) );
210 * Gets the buffer this mark is located inside,
211 * or NULL if the mark is deleted.
212 * mark:
213 * a GtkTextMark
214 * Returns:
215 * the mark's GtkTextBuffer
217 public TextBuffer getBuffer()
219 // GtkTextBuffer* gtk_text_mark_get_buffer (GtkTextMark *mark);
220 return new TextBuffer( gtk_text_mark_get_buffer(gtkTextMark) );
224 * Determines whether the mark has left gravity.
225 * mark:
226 * a GtkTextMark
227 * Returns:
228 * TRUE if the mark has left gravity, FALSE otherwise
229 * [3]
230 * "left" and "right" here refer to logical direction (left is the toward the start
231 * of the buffer); in some languages such as Hebrew the logically-leftmost text is
232 * not actually on the left when displayed.
234 public int getLeftGravity()
236 // gboolean gtk_text_mark_get_left_gravity (GtkTextMark *mark);
237 return gtk_text_mark_get_left_gravity(gtkTextMark);