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