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 = GtkSourceMark.html 27 * outPack = gsv 28 * outFile = SourceMark 29 * strct = GtkSourceMark 30 * realStrct= 31 * ctorStrct= 32 * clss = SourceMark 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_mark_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * structWrap: 48 * - GtkSourceMark* -> SourceMark 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gsv.SourceMark; 55 56 public import gsvc.gsvtypes; 57 58 private import gsvc.gsv; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 63 private import glib.Str; 64 65 66 67 private import gtk.TextMark; 68 69 /** 70 * A GtkSourceMark marks a position in the text where you want to display 71 * additional info. It is based on GtkTextMark and thus is still valid after 72 * the text has changed though its position may change. 73 * 74 * GtkSourceMarks are organised in categories which you have to set 75 * when you create the mark. Each category can have a priority, a pixbuf and 76 * other associated attributes. See gtk_source_view_set_mark_attributes(). 77 * The pixbuf will be displayed in the margin at the line where the mark 78 * residents if the "show-line-marks" property is set to TRUE. If 79 * there are multiple marks in the same line, the pixbufs will be drawn on top 80 * of each other. The mark with the highest priority will be drawn on top. 81 */ 82 public class SourceMark : TextMark 83 { 84 85 /** the main Gtk struct */ 86 protected GtkSourceMark* gtkSourceMark; 87 88 89 public GtkSourceMark* getSourceMarkStruct() 90 { 91 return gtkSourceMark; 92 } 93 94 95 /** the main Gtk struct as a void* */ 96 protected override void* getStruct() 97 { 98 return cast(void*)gtkSourceMark; 99 } 100 101 /** 102 * Sets our main struct and passes it to the parent class 103 */ 104 public this (GtkSourceMark* gtkSourceMark) 105 { 106 super(cast(GtkTextMark*)gtkSourceMark); 107 this.gtkSourceMark = gtkSourceMark; 108 } 109 110 protected override void setStruct(GObject* obj) 111 { 112 super.setStruct(obj); 113 gtkSourceMark = cast(GtkSourceMark*)obj; 114 } 115 116 /** 117 */ 118 119 /** 120 * Creates a text mark. Add it to a buffer using gtk_text_buffer_add_mark(). 121 * If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved 122 * by name using gtk_text_buffer_get_mark(). 123 * Normally marks are created using the utility function 124 * gtk_source_buffer_create_source_mark(). 125 * Since 2.2 126 * Params: 127 * name = Name of the GtkSourceMark, can be NULL when not using a name 128 * category = is used to classify marks according to common characteristics 129 * (e.g. all the marks representing a bookmark could belong to the "bookmark" 130 * category, or all the marks representing a compilation error could belong to 131 * "error" category). 132 * Throws: ConstructionException GTK+ fails to create the object. 133 */ 134 public this (string name, string category) 135 { 136 // GtkSourceMark * gtk_source_mark_new (const gchar *name, const gchar *category); 137 auto p = gtk_source_mark_new(Str.toStringz(name), Str.toStringz(category)); 138 if(p is null) 139 { 140 throw new ConstructionException("null returned by gtk_source_mark_new(Str.toStringz(name), Str.toStringz(category))"); 141 } 142 this(cast(GtkSourceMark*) p); 143 } 144 145 /** 146 * Returns the mark category. 147 * Since 2.2 148 * Returns: the category of the GtkSourceMark. 149 */ 150 public string getCategory() 151 { 152 // const gchar * gtk_source_mark_get_category (GtkSourceMark *mark); 153 return Str.toString(gtk_source_mark_get_category(gtkSourceMark)); 154 } 155 156 /** 157 * Returns the next GtkSourceMark in the buffer or NULL if the mark 158 * was not added to a buffer. If there is no next mark, NULL will be returned. 159 * If category is NULL, looks for marks of any category. 160 * Since 2.2 161 * Params: 162 * category = a string specifying the mark category, or NULL. [allow-none] 163 * Returns: the next GtkSourceMark, or NULL. [transfer none] 164 */ 165 public SourceMark next(string category) 166 { 167 // GtkSourceMark * gtk_source_mark_next (GtkSourceMark *mark, const gchar *category); 168 auto p = gtk_source_mark_next(gtkSourceMark, Str.toStringz(category)); 169 170 if(p is null) 171 { 172 return null; 173 } 174 175 return ObjectG.getDObject!(SourceMark)(cast(GtkSourceMark*) p); 176 } 177 178 /** 179 * Returns the previous GtkSourceMark in the buffer or NULL if the mark 180 * was not added to a buffer. If there is no previous mark, NULL is returned. 181 * If category is NULL, looks for marks of any category 182 * Since 2.2 183 * Params: 184 * category = a string specifying the mark category, or NULL. 185 * Returns: the previous GtkSourceMark, or NULL. [transfer none] 186 */ 187 public SourceMark prev(string category) 188 { 189 // GtkSourceMark * gtk_source_mark_prev (GtkSourceMark *mark, const gchar *category); 190 auto p = gtk_source_mark_prev(gtkSourceMark, Str.toStringz(category)); 191 192 if(p is null) 193 { 194 return null; 195 } 196 197 return ObjectG.getDObject!(SourceMark)(cast(GtkSourceMark*) p); 198 } 199 }