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