alternative to assert
[gtkD.git] / gtkD / srcsv / gsv / SourceLanguage.d
blob8dd446a3b0595a6b76023762afd497950ff00886
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkSourceLanguage.html
26 * outPack = gsv
27 * outFile = SourceLanguage
28 * strct = GtkSourceLanguage
29 * realStrct=
30 * ctorStrct=
31 * clss = SourceLanguage
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_source_iter_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gsv.SourceStyleScheme
45 * - glib.Str
46 * structWrap:
47 * - GtkSourceStyleScheme* -> SourceStyleScheme
48 * module aliases:
49 * local aliases:
52 module gsv.SourceLanguage;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gsvc.gsvtypes;
64 private import gsvc.gsv;
67 private import gsv.SourceStyleScheme;
68 private import glib.Str;
73 /**
74 * Description
76 private import gobject.ObjectG;
77 public class SourceLanguage : ObjectG
80 /** the main Gtk struct */
81 protected GtkSourceLanguage* gtkSourceLanguage;
84 public GtkSourceLanguage* getSourceLanguageStruct()
86 return gtkSourceLanguage;
90 /** the main Gtk struct as a void* */
91 protected void* getStruct()
93 return cast(void*)gtkSourceLanguage;
96 /**
97 * Sets our main struct and passes it to the parent class
99 public this (GtkSourceLanguage* gtkSourceLanguage)
101 version(noAssert)
103 if ( gtkSourceLanguage is null )
105 int zero = 0;
106 version(Tango)
108 Stdout("struct gtkSourceLanguage is null on constructor").newline;
110 else
112 printf("struct gtkSourceLanguage is null on constructor");
114 zero = zero / zero;
117 else
119 assert(gtkSourceLanguage !is null, "struct gtkSourceLanguage is null on constructor");
121 super(cast(GObject*)gtkSourceLanguage);
122 this.gtkSourceLanguage = gtkSourceLanguage;
128 // imports for the signal processing
129 private import gobject.Signals;
130 private import gtkc.gdktypes;
131 int[char[]] connectedSignals;
133 void delegate(char[], SourceLanguage)[] onTagStyleChangedListeners;
134 void addOnTagStyleChanged(void delegate(char[], SourceLanguage) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
136 if ( !("tag-style-changed" in connectedSignals) )
138 Signals.connectData(
139 getStruct(),
140 "tag-style-changed",
141 cast(GCallback)&callBackTagStyleChanged,
142 cast(void*)this,
143 null,
144 connectFlags);
145 connectedSignals["tag-style-changed"] = 1;
147 onTagStyleChangedListeners ~= dlg;
149 extern(C) static void callBackTagStyleChanged(GtkSourceLanguage* sourcelanguageStruct, gchar* arg1, SourceLanguage sourceLanguage)
151 bool consumed = false;
153 foreach ( void delegate(char[], SourceLanguage) dlg ; sourceLanguage.onTagStyleChangedListeners )
155 dlg(Str.toString(arg1), sourceLanguage);
158 return consumed;
164 * Returns the localized name of the language.
165 * language:
166 * a GtkSourceLanguage.
167 * Returns:
168 * the name of language.
170 public char[] gtkSourceLanguageGetName()
172 // gchar* gtk_source_language_get_name (GtkSourceLanguage *language);
173 return Str.toString(gtk_source_language_get_name(gtkSourceLanguage) );
177 * Returns the localized section of the language.
178 * Each language belong to a section (ex. HTML belogs to the
179 * Markup section).
180 * language:
181 * a GtkSourceLanguage.
182 * Returns:
183 * the section of language.
185 public char[] gtkSourceLanguageGetSection()
187 // gchar* gtk_source_language_get_section (GtkSourceLanguage *language);
188 return Str.toString(gtk_source_language_get_section(gtkSourceLanguage) );
192 * Returns a list of tags for the given language. You should unref the tags
193 * and free the list after usage.
194 * language:
195 * a GtkSourceLanguage.
196 * Returns:
197 * a list of GtkSourceTag objects.
199 public GSList* gtkSourceLanguageGetTags()
201 // GSList* gtk_source_language_get_tags (GtkSourceLanguage *language);
202 return gtk_source_language_get_tags(gtkSourceLanguage);
206 * Gets the value of the ESC character in the given language.
207 * language:
208 * a GtkSourceLanguage.
209 * Returns:
210 * the value of the ESC character.
212 public gunichar gtkSourceLanguageGetEscapeChar()
214 // gunichar gtk_source_language_get_escape_char (GtkSourceLanguage *language);
215 return gtk_source_language_get_escape_char(gtkSourceLanguage);
219 * Returns a list of mime types for the given language. After usage you should
220 * free each element of the list as well as the list itself.
221 * language:
222 * a GtkSourceLanguage.
223 * Returns:
224 * a list of mime types (strings).
226 public GSList* gtkSourceLanguageGetMimeTypes()
228 // GSList* gtk_source_language_get_mime_types (GtkSourceLanguage *language);
229 return gtk_source_language_get_mime_types(gtkSourceLanguage);
233 * Sets a list of mime_types for the given language.
234 * If mime_types is NULL this function will use the default mime
235 * types from the language file.
236 * language:
237 * a GtkSourceLanguage
238 * mime_types:
239 * a list of mime types (strings).
241 public void gtkSourceLanguageSetMimeTypes(GSList* mimeTypes)
243 // void gtk_source_language_set_mime_types (GtkSourceLanguage *language, const GSList *mime_types);
244 gtk_source_language_set_mime_types(gtkSourceLanguage, mimeTypes);
248 * Gets the style scheme associated with the given language.
249 * language:
250 * a GtkSourceLanguage.
251 * Returns:
252 * a GtkSourceStyleScheme.
254 public SourceStyleScheme gtkSourceLanguageGetStyleScheme()
256 // GtkSourceStyleScheme* gtk_source_language_get_style_scheme (GtkSourceLanguage *language);
257 return new SourceStyleScheme( gtk_source_language_get_style_scheme(gtkSourceLanguage) );
261 * Sets the style scheme of the given language.
262 * language:
263 * a GtkSourceLanguage.
264 * scheme:
265 * a GtkSourceStyleScheme.
267 public void gtkSourceLanguageSetStyleScheme(SourceStyleScheme scheme)
269 // void gtk_source_language_set_style_scheme (GtkSourceLanguage *language, GtkSourceStyleScheme *scheme);
270 gtk_source_language_set_style_scheme(gtkSourceLanguage, (scheme is null) ? null : scheme.getSourceStyleSchemeStruct());
274 * Gets the style of the tag whose ID is tag_id. If the style is
275 * not defined then returns the default style.
276 * language:
277 * a GtkSourceLanguage.
278 * tag_id:
279 * the ID of a GtkSourceTag.
280 * Returns:
281 * a GtkSourceTagStyle.
283 public GtkSourceTagStyle* gtkSourceLanguageGetTagStyle(char[] tagId)
285 // GtkSourceTagStyle* gtk_source_language_get_tag_style (GtkSourceLanguage *language, const gchar *tag_id);
286 return gtk_source_language_get_tag_style(gtkSourceLanguage, Str.toStringz(tagId));
290 * Sets the style of the tag whose ID is tag_id. If style is NULL
291 * restore the default style.
292 * language:
293 * a GtkSourceLanguage.
294 * tag_id:
295 * the ID of a GtkSourceTag.
296 * style:
297 * a GtkSourceTagStyle.
299 public void gtkSourceLanguageSetTagStyle(char[] tagId, GtkSourceTagStyle* style)
301 // void gtk_source_language_set_tag_style (GtkSourceLanguage *language, const gchar *tag_id, const GtkSourceTagStyle *style);
302 gtk_source_language_set_tag_style(gtkSourceLanguage, Str.toStringz(tagId), style);
306 * Gets the default style of the tag whose ID is tag_id.
307 * language:
308 * a GtkSourceLanguage.
309 * tag_id:
310 * the ID of a GtkSourceTag.
311 * Returns:
312 * a GtkSourceTagStyle.
313 * Signal Details
314 * The "tag-style-changed" signal
315 * void user_function (GtkSourceLanguage *sourcelanguage,
316 * gchar *arg1,
317 * gpointer user_data) : Run last
318 * sourcelanguage:
319 * the object which received the signal.
320 * arg1:
321 * user_data:
322 * user data set when the signal handler was connected.
324 public GtkSourceTagStyle* gtkSourceLanguageGetTagDefaultStyle(char[] tagId)
326 // GtkSourceTagStyle* gtk_source_language_get_tag_default_style (GtkSourceLanguage *language, const gchar *tag_id);
327 return gtk_source_language_get_tag_default_style(gtkSourceLanguage, Str.toStringz(tagId));