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