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 module gsv.SourceMark; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gsvc.gsv; 31 public import gsvc.gsvtypes; 32 private import gtk.TextMark; 33 34 35 /** */ 36 public class SourceMark : TextMark 37 { 38 /** the main Gtk struct */ 39 protected GtkSourceMark* gtkSourceMark; 40 41 /** Get the main Gtk struct */ 42 public GtkSourceMark* getSourceMarkStruct(bool transferOwnership = false) 43 { 44 if (transferOwnership) 45 ownedRef = false; 46 return gtkSourceMark; 47 } 48 49 /** the main Gtk struct as a void* */ 50 protected override void* getStruct() 51 { 52 return cast(void*)gtkSourceMark; 53 } 54 55 protected override void setStruct(GObject* obj) 56 { 57 gtkSourceMark = cast(GtkSourceMark*)obj; 58 super.setStruct(obj); 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (GtkSourceMark* gtkSourceMark, bool ownedRef = false) 65 { 66 this.gtkSourceMark = gtkSourceMark; 67 super(cast(GtkTextMark*)gtkSourceMark, ownedRef); 68 } 69 70 71 /** */ 72 public static GType getType() 73 { 74 return gtk_source_mark_get_type(); 75 } 76 77 /** 78 * Creates a text mark. Add it to a buffer using gtk_text_buffer_add_mark(). 79 * If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved 80 * by name using gtk_text_buffer_get_mark(). 81 * Normally marks are created using the utility function 82 * gtk_source_buffer_create_source_mark(). 83 * 84 * Params: 85 * name = Name of the #GtkSourceMark, can be NULL when not using a name 86 * category = is used to classify marks according to common characteristics 87 * (e.g. all the marks representing a bookmark could belong to the "bookmark" 88 * category, or all the marks representing a compilation error could belong to 89 * "error" category). 90 * 91 * Returns: a new #GtkSourceMark that can be added using gtk_text_buffer_add_mark(). 92 * 93 * Since: 2.2 94 * 95 * Throws: ConstructionException GTK+ fails to create the object. 96 */ 97 public this(string name, string category) 98 { 99 auto p = gtk_source_mark_new(Str.toStringz(name), Str.toStringz(category)); 100 101 if(p is null) 102 { 103 throw new ConstructionException("null returned by new"); 104 } 105 106 this(cast(GtkSourceMark*) p, true); 107 } 108 109 /** 110 * Returns the mark category. 111 * 112 * Returns: the category of the #GtkSourceMark. 113 * 114 * Since: 2.2 115 */ 116 public string getCategory() 117 { 118 return Str.toString(gtk_source_mark_get_category(gtkSourceMark)); 119 } 120 121 /** 122 * Returns the next #GtkSourceMark in the buffer or %NULL if the mark 123 * was not added to a buffer. If there is no next mark, %NULL will be returned. 124 * 125 * If @category is %NULL, looks for marks of any category. 126 * 127 * Params: 128 * category = a string specifying the mark category, or %NULL. 129 * 130 * Returns: the next #GtkSourceMark, or %NULL. 131 * 132 * Since: 2.2 133 */ 134 public SourceMark next(string category) 135 { 136 auto p = gtk_source_mark_next(gtkSourceMark, Str.toStringz(category)); 137 138 if(p is null) 139 { 140 return null; 141 } 142 143 return ObjectG.getDObject!(SourceMark)(cast(GtkSourceMark*) p); 144 } 145 146 /** 147 * Returns the previous #GtkSourceMark in the buffer or %NULL if the mark 148 * was not added to a buffer. If there is no previous mark, %NULL is returned. 149 * 150 * If @category is %NULL, looks for marks of any category 151 * 152 * Params: 153 * category = a string specifying the mark category, or %NULL. 154 * 155 * Returns: the previous #GtkSourceMark, or %NULL. 156 * 157 * Since: 2.2 158 */ 159 public SourceMark prev(string category) 160 { 161 auto p = gtk_source_mark_prev(gtkSourceMark, Str.toStringz(category)); 162 163 if(p is null) 164 { 165 return null; 166 } 167 168 return ObjectG.getDObject!(SourceMark)(cast(GtkSourceMark*) p); 169 } 170 }