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