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