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