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