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.SourceStyleSchemeManager;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gsv.SourceStyleScheme;
31 private import gsv.c.functions;
32 public  import gsv.c.types;
33 public  import gsvc.gsvtypes;
34 
35 
36 /** */
37 public class SourceStyleSchemeManager : ObjectG
38 {
39 	/** the main Gtk struct */
40 	protected GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager;
41 
42 	/** Get the main Gtk struct */
43 	public GtkSourceStyleSchemeManager* getSourceStyleSchemeManagerStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return gtkSourceStyleSchemeManager;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)gtkSourceStyleSchemeManager;
54 	}
55 
56 	protected override void setStruct(GObject* obj)
57 	{
58 		gtkSourceStyleSchemeManager = cast(GtkSourceStyleSchemeManager*)obj;
59 		super.setStruct(obj);
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager, bool ownedRef = false)
66 	{
67 		this.gtkSourceStyleSchemeManager = gtkSourceStyleSchemeManager;
68 		super(cast(GObject*)gtkSourceStyleSchemeManager, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gtk_source_style_scheme_manager_get_type();
76 	}
77 
78 	/**
79 	 * Creates a new style manager. If you do not need more than one style
80 	 * manager then use gtk_source_style_scheme_manager_get_default() instead.
81 	 *
82 	 * Returns: a new #GtkSourceStyleSchemeManager.
83 	 *
84 	 * Throws: ConstructionException GTK+ fails to create the object.
85 	 */
86 	public this()
87 	{
88 		auto p = gtk_source_style_scheme_manager_new();
89 
90 		if(p is null)
91 		{
92 			throw new ConstructionException("null returned by new");
93 		}
94 
95 		this(cast(GtkSourceStyleSchemeManager*) p, true);
96 	}
97 
98 	/**
99 	 * Returns the default #GtkSourceStyleSchemeManager instance.
100 	 *
101 	 * Returns: a #GtkSourceStyleSchemeManager. Return value
102 	 *     is owned by GtkSourceView library and must not be unref'ed.
103 	 */
104 	public static SourceStyleSchemeManager getDefault()
105 	{
106 		auto p = gtk_source_style_scheme_manager_get_default();
107 
108 		if(p is null)
109 		{
110 			return null;
111 		}
112 
113 		return ObjectG.getDObject!(SourceStyleSchemeManager)(cast(GtkSourceStyleSchemeManager*) p);
114 	}
115 
116 	/**
117 	 * Appends @path to the list of directories where the @manager looks for
118 	 * style scheme files.
119 	 * See gtk_source_style_scheme_manager_set_search_path() for details.
120 	 *
121 	 * Params:
122 	 *     path = a directory or a filename.
123 	 */
124 	public void appendSearchPath(string path)
125 	{
126 		gtk_source_style_scheme_manager_append_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path));
127 	}
128 
129 	/**
130 	 * Mark any currently cached information about the available style scehems
131 	 * as invalid. All the available style schemes will be reloaded next time
132 	 * the @manager is accessed.
133 	 */
134 	public void forceRescan()
135 	{
136 		gtk_source_style_scheme_manager_force_rescan(gtkSourceStyleSchemeManager);
137 	}
138 
139 	/**
140 	 * Looks up style scheme by id.
141 	 *
142 	 * Params:
143 	 *     schemeId = style scheme id to find.
144 	 *
145 	 * Returns: a #GtkSourceStyleScheme object. Returned value is owned by
146 	 *     @manager and must not be unref'ed.
147 	 */
148 	public SourceStyleScheme getScheme(string schemeId)
149 	{
150 		auto p = gtk_source_style_scheme_manager_get_scheme(gtkSourceStyleSchemeManager, Str.toStringz(schemeId));
151 
152 		if(p is null)
153 		{
154 			return null;
155 		}
156 
157 		return ObjectG.getDObject!(SourceStyleScheme)(cast(GtkSourceStyleScheme*) p);
158 	}
159 
160 	/**
161 	 * Returns the ids of the available style schemes.
162 	 *
163 	 * Returns: a %NULL-terminated array of strings containing the ids of the available
164 	 *     style schemes or %NULL if no style scheme is available.
165 	 *     The array is sorted alphabetically according to the scheme name.
166 	 *     The array is owned by the @manager and must not be modified.
167 	 */
168 	public string[] getSchemeIds()
169 	{
170 		return Str.toStringArray(gtk_source_style_scheme_manager_get_scheme_ids(gtkSourceStyleSchemeManager));
171 	}
172 
173 	/**
174 	 * Returns the current search path for the @manager.
175 	 * See gtk_source_style_scheme_manager_set_search_path() for details.
176 	 *
177 	 * Returns: a %NULL-terminated array
178 	 *     of string containing the search path.
179 	 *     The array is owned by the @manager and must not be modified.
180 	 */
181 	public string[] getSearchPath()
182 	{
183 		return Str.toStringArray(gtk_source_style_scheme_manager_get_search_path(gtkSourceStyleSchemeManager));
184 	}
185 
186 	/**
187 	 * Prepends @path to the list of directories where the @manager looks
188 	 * for style scheme files.
189 	 * See gtk_source_style_scheme_manager_set_search_path() for details.
190 	 *
191 	 * Params:
192 	 *     path = a directory or a filename.
193 	 */
194 	public void prependSearchPath(string path)
195 	{
196 		gtk_source_style_scheme_manager_prepend_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path));
197 	}
198 
199 	/**
200 	 * Sets the list of directories where the @manager looks for
201 	 * style scheme files.
202 	 * If @path is %NULL, the search path is reset to default.
203 	 *
204 	 * Params:
205 	 *     path = a %NULL-terminated array of strings or %NULL.
206 	 */
207 	public void setSearchPath(string[] path)
208 	{
209 		gtk_source_style_scheme_manager_set_search_path(gtkSourceStyleSchemeManager, Str.toStringzArray(path));
210 	}
211 }