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.SourceLanguage;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gsvc.gsv;
30 public  import gsvc.gsvtypes;
31 
32 
33 /** */
34 public class SourceLanguage : ObjectG
35 {
36 	/** the main Gtk struct */
37 	protected GtkSourceLanguage* gtkSourceLanguage;
38 
39 	/** Get the main Gtk struct */
40 	public GtkSourceLanguage* getSourceLanguageStruct()
41 	{
42 		return gtkSourceLanguage;
43 	}
44 
45 	/** the main Gtk struct as a void* */
46 	protected override void* getStruct()
47 	{
48 		return cast(void*)gtkSourceLanguage;
49 	}
50 
51 	protected override void setStruct(GObject* obj)
52 	{
53 		gtkSourceLanguage = cast(GtkSourceLanguage*)obj;
54 		super.setStruct(obj);
55 	}
56 
57 	/**
58 	 * Sets our main struct and passes it to the parent class.
59 	 */
60 	public this (GtkSourceLanguage* gtkSourceLanguage, bool ownedRef = false)
61 	{
62 		this.gtkSourceLanguage = gtkSourceLanguage;
63 		super(cast(GObject*)gtkSourceLanguage, ownedRef);
64 	}
65 
66 
67 	/** */
68 	public static GType getType()
69 	{
70 		return gtk_source_language_get_type();
71 	}
72 
73 	/**
74 	 * Returns the globs associated to this language. This is just
75 	 * an utility wrapper around gtk_source_language_get_metadata() to
76 	 * retrieve the "globs" metadata property and split it into an array.
77 	 *
78 	 * Return: a newly-allocated %NULL terminated array containing the globs or %NULL
79 	 *     if no globs are found.
80 	 *     The returned array must be freed with g_strfreev().
81 	 */
82 	public string[] getGlobs()
83 	{
84 		auto retStr = gtk_source_language_get_globs(gtkSourceLanguage);
85 		
86 		scope(exit) Str.freeStringArray(retStr);
87 		return Str.toStringArray(retStr);
88 	}
89 
90 	/**
91 	 * Returns whether the language should be hidden from the user.
92 	 *
93 	 * Return: %TRUE if the language should be hidden, %FALSE otherwise.
94 	 */
95 	public bool getHidden()
96 	{
97 		return gtk_source_language_get_hidden(gtkSourceLanguage) != 0;
98 	}
99 
100 	/**
101 	 * Returns the ID of the language. The ID is not locale-dependent.
102 	 * The returned string is owned by @language and should not be freed
103 	 * or modified.
104 	 *
105 	 * Return: the ID of @language.
106 	 */
107 	public string getId()
108 	{
109 		return Str.toString(gtk_source_language_get_id(gtkSourceLanguage));
110 	}
111 
112 	/**
113 	 *
114 	 * Params:
115 	 *     name = metadata property name.
116 	 * Return: value of property @name stored in
117 	 *     the metadata of @language or %NULL if language does not contain the
118 	 *     specified metadata property.
119 	 *     The returned string is owned by @language and should not be freed
120 	 *     or modified.
121 	 */
122 	public string getMetadata(string name)
123 	{
124 		return Str.toString(gtk_source_language_get_metadata(gtkSourceLanguage, Str.toStringz(name)));
125 	}
126 
127 	/**
128 	 * Returns the mime types associated to this language. This is just
129 	 * an utility wrapper around gtk_source_language_get_metadata() to
130 	 * retrieve the "mimetypes" metadata property and split it into an
131 	 * array.
132 	 *
133 	 * Return: a newly-allocated %NULL terminated array containing the mime types
134 	 *     or %NULL if no mime types are found.
135 	 *     The returned array must be freed with g_strfreev().
136 	 */
137 	public string[] getMimeTypes()
138 	{
139 		auto retStr = gtk_source_language_get_mime_types(gtkSourceLanguage);
140 		
141 		scope(exit) Str.freeStringArray(retStr);
142 		return Str.toStringArray(retStr);
143 	}
144 
145 	/**
146 	 * Returns the localized name of the language.
147 	 * The returned string is owned by @language and should not be freed
148 	 * or modified.
149 	 *
150 	 * Return: the name of @language.
151 	 */
152 	public string getName()
153 	{
154 		return Str.toString(gtk_source_language_get_name(gtkSourceLanguage));
155 	}
156 
157 	/**
158 	 * Returns the localized section of the language.
159 	 * Each language belong to a section (ex. HTML belogs to the
160 	 * Markup section).
161 	 * The returned string is owned by @language and should not be freed
162 	 * or modified.
163 	 *
164 	 * Return: the section of @language.
165 	 */
166 	public string getSection()
167 	{
168 		return Str.toString(gtk_source_language_get_section(gtkSourceLanguage));
169 	}
170 
171 	/**
172 	 * Returns the ID of the style to use if the specified @style_id
173 	 * is not present in the current style scheme.
174 	 *
175 	 * Params:
176 	 *     styleId = a style ID.
177 	 *
178 	 * Return: the ID of the style to use if the
179 	 *     specified @style_id is not present in the current style scheme or %NULL
180 	 *     if the style has no fallback defined.
181 	 *     The returned string is owned by the @language and must not be modified.
182 	 *
183 	 * Since: 3.4
184 	 */
185 	public string getStyleFallback(string styleId)
186 	{
187 		return Str.toString(gtk_source_language_get_style_fallback(gtkSourceLanguage, Str.toStringz(styleId)));
188 	}
189 
190 	/**
191 	 * Returns the ids of the styles defined by this @language.
192 	 *
193 	 * Return: a newly-allocated %NULL terminated array containing ids of the
194 	 *     styles defined by this @language or %NULL if no style is defined.
195 	 *     The returned array must be freed with g_strfreev().
196 	 */
197 	public string[] getStyleIds()
198 	{
199 		auto retStr = gtk_source_language_get_style_ids(gtkSourceLanguage);
200 		
201 		scope(exit) Str.freeStringArray(retStr);
202 		return Str.toStringArray(retStr);
203 	}
204 
205 	/**
206 	 * Returns the name of the style with ID @style_id defined by this @language.
207 	 *
208 	 * Params:
209 	 *     styleId = a style ID.
210 	 *
211 	 * Return: the name of the style with ID @style_id
212 	 *     defined by this @language or %NULL if the style has no name or there is no
213 	 *     style with ID @style_id defined by this @language.
214 	 *     The returned string is owned by the @language and must not be modified.
215 	 */
216 	public string getStyleName(string styleId)
217 	{
218 		return Str.toString(gtk_source_language_get_style_name(gtkSourceLanguage, Str.toStringz(styleId)));
219 	}
220 }