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