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