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 of strings containing the ids of the available
161 	 *     style schemes or %NULL if no style scheme is available.
162 	 *     The array is sorted alphabetically according to the scheme name.
163 	 *     The array is owned by the @manager and must not be modified.
164 	 */
165 	public string[] getSchemeIds()
166 	{
167 		return Str.toStringArray(gtk_source_style_scheme_manager_get_scheme_ids(gtkSourceStyleSchemeManager));
168 	}
169 
170 	/**
171 	 * Returns the current search path for the @manager.
172 	 * See gtk_source_style_scheme_manager_set_search_path() for details.
173 	 *
174 	 * Return: a %NULL-terminated array
175 	 *     of string containing the search path.
176 	 *     The array is owned by the @manager and must not be modified.
177 	 */
178 	public string[] getSearchPath()
179 	{
180 		return Str.toStringArray(gtk_source_style_scheme_manager_get_search_path(gtkSourceStyleSchemeManager));
181 	}
182 
183 	/**
184 	 * Prepends @path to the list of directories where the @manager looks
185 	 * for style scheme files.
186 	 * See gtk_source_style_scheme_manager_set_search_path() for details.
187 	 *
188 	 * Params:
189 	 *     path = a directory or a filename.
190 	 */
191 	public void prependSearchPath(string path)
192 	{
193 		gtk_source_style_scheme_manager_prepend_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path));
194 	}
195 
196 	/**
197 	 * Sets the list of directories where the @manager looks for
198 	 * style scheme files.
199 	 * If @path is %NULL, the search path is reset to default.
200 	 *
201 	 * Params:
202 	 *     path = a %NULL-terminated array of strings or %NULL.
203 	 */
204 	public void setSearchPath(string[] path)
205 	{
206 		gtk_source_style_scheme_manager_set_search_path(gtkSourceStyleSchemeManager, Str.toStringzArray(path));
207 	}
208 }