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  = GtkTextMark.html
27  * outPack = gtk
28  * outFile = TextMark
29  * strct   = GtkTextMark
30  * realStrct=
31  * ctorStrct=
32  * clss    = TextMark
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_text_mark_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtk.TextBuffer
48  * structWrap:
49  * 	- GtkTextBuffer* -> TextBuffer
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.TextMark;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 private import glib.Str;
64 private import gtk.TextBuffer;
65 
66 
67 private import gobject.ObjectG;
68 
69 /**
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  *
74  * A GtkTextMark is like a bookmark in a text buffer; it preserves a position in
75  * the text. You can convert the mark to an iterator using
76  * gtk_text_buffer_get_iter_at_mark(). Unlike iterators, marks remain valid across
77  * buffer mutations, because their behavior is defined when text is inserted or
78  * deleted. When text containing a mark is deleted, the mark remains in the
79  * position originally occupied by the deleted text. When text is inserted at a
80  * mark, a mark with left gravity will be moved to the
81  * beginning of the newly-inserted text, and a mark with right
82  * gravity will be moved to the end.
83  *
84  * [3]
85  *
86  * Marks are reference counted, but the reference count only controls the validity
87  * of the memory; marks can be deleted from the buffer at any time with
88  * gtk_text_buffer_delete_mark(). Once deleted from the buffer, a mark is
89  * essentially useless.
90  *
91  * Marks optionally have names; these can be convenient to avoid passing the
92  * GtkTextMark object around.
93  *
94  * Marks are typically created using the gtk_text_buffer_create_mark() function.
95  */
96 public class TextMark : ObjectG
97 {
98 	
99 	/** the main Gtk struct */
100 	protected GtkTextMark* gtkTextMark;
101 	
102 	
103 	/** Get the main Gtk struct */
104 	public GtkTextMark* getTextMarkStruct()
105 	{
106 		return gtkTextMark;
107 	}
108 	
109 	
110 	/** the main Gtk struct as a void* */
111 	protected override void* getStruct()
112 	{
113 		return cast(void*)gtkTextMark;
114 	}
115 	
116 	/**
117 	 * Sets our main struct and passes it to the parent class
118 	 */
119 	public this (GtkTextMark* gtkTextMark)
120 	{
121 		super(cast(GObject*)gtkTextMark);
122 		this.gtkTextMark = gtkTextMark;
123 	}
124 	
125 	protected override void setStruct(GObject* obj)
126 	{
127 		super.setStruct(obj);
128 		gtkTextMark = cast(GtkTextMark*)obj;
129 	}
130 	
131 	/**
132 	 */
133 	
134 	/**
135 	 * Creates a text mark. Add it to a buffer using gtk_text_buffer_add_mark().
136 	 * If name is NULL, the mark is anonymous; otherwise, the mark can be
137 	 * retrieved by name using gtk_text_buffer_get_mark(). If a mark has left
138 	 * gravity, and text is inserted at the mark's current location, the mark
139 	 * will be moved to the left of the newly-inserted text. If the mark has
140 	 * right gravity (left_gravity = FALSE), the mark will end up on the
141 	 * right of newly-inserted text. The standard left-to-right cursor is a
142 	 * mark with right gravity (when you type, the cursor stays on the right
143 	 * side of the text you're typing).
144 	 * Since 2.12
145 	 * Params:
146 	 * name = mark name or NULL. [allow-none]
147 	 * leftGravity = whether the mark should have left gravity
148 	 * Throws: ConstructionException GTK+ fails to create the object.
149 	 */
150 	public this (string name, int leftGravity)
151 	{
152 		// GtkTextMark * gtk_text_mark_new (const gchar *name,  gboolean left_gravity);
153 		auto p = gtk_text_mark_new(Str.toStringz(name), leftGravity);
154 		if(p is null)
155 		{
156 			throw new ConstructionException("null returned by gtk_text_mark_new(Str.toStringz(name), leftGravity)");
157 		}
158 		this(cast(GtkTextMark*) p);
159 	}
160 	
161 	/**
162 	 * Sets the visibility of mark; the insertion point is normally
163 	 * visible, i.e. you can see it as a vertical bar. Also, the text
164 	 * widget uses a visible mark to indicate where a drop will occur when
165 	 * dragging-and-dropping text. Most other marks are not visible.
166 	 * Marks are not visible by default.
167 	 * Params:
168 	 * setting = visibility of mark
169 	 */
170 	public void setVisible(int setting)
171 	{
172 		// void gtk_text_mark_set_visible (GtkTextMark *mark,  gboolean setting);
173 		gtk_text_mark_set_visible(gtkTextMark, setting);
174 	}
175 	
176 	/**
177 	 * Returns TRUE if the mark is visible (i.e. a cursor is displayed
178 	 * for it).
179 	 * Returns: TRUE if visible
180 	 */
181 	public int getVisible()
182 	{
183 		// gboolean gtk_text_mark_get_visible (GtkTextMark *mark);
184 		return gtk_text_mark_get_visible(gtkTextMark);
185 	}
186 	
187 	/**
188 	 * Returns TRUE if the mark has been removed from its buffer
189 	 * with gtk_text_buffer_delete_mark(). See gtk_text_buffer_add_mark()
190 	 * for a way to add it to a buffer again.
191 	 * Returns: whether the mark is deleted
192 	 */
193 	public int getDeleted()
194 	{
195 		// gboolean gtk_text_mark_get_deleted (GtkTextMark *mark);
196 		return gtk_text_mark_get_deleted(gtkTextMark);
197 	}
198 	
199 	/**
200 	 * Returns the mark name; returns NULL for anonymous marks.
201 	 * Returns: mark name
202 	 */
203 	public string getName()
204 	{
205 		// const gchar * gtk_text_mark_get_name (GtkTextMark *mark);
206 		return Str.toString(gtk_text_mark_get_name(gtkTextMark));
207 	}
208 	
209 	/**
210 	 * Gets the buffer this mark is located inside,
211 	 * or NULL if the mark is deleted.
212 	 * Returns: the mark's GtkTextBuffer. [transfer none]
213 	 */
214 	public TextBuffer getBuffer()
215 	{
216 		// GtkTextBuffer * gtk_text_mark_get_buffer (GtkTextMark *mark);
217 		auto p = gtk_text_mark_get_buffer(gtkTextMark);
218 		
219 		if(p is null)
220 		{
221 			return null;
222 		}
223 		
224 		return ObjectG.getDObject!(TextBuffer)(cast(GtkTextBuffer*) p);
225 	}
226 	
227 	/**
228 	 * Determines whether the mark has left gravity.
229 	 * Returns: TRUE if the mark has left gravity, FALSE otherwise
230 	 */
231 	public int getLeftGravity()
232 	{
233 		// gboolean gtk_text_mark_get_left_gravity (GtkTextMark *mark);
234 		return gtk_text_mark_get_left_gravity(gtkTextMark);
235 	}
236 }