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 62 private import glib.Str; 63 64 65 66 private import gobject.ObjectG; 67 68 /** 69 * GtkSourceLanguage encapsulates syntax and highlighting styles for a 70 * particular language. Use GtkSourceLanguageManager to obtain a 71 * GtkSourceLanguage instance, and gtk_source_buffer_set_language() to apply it 72 * to a GtkSourceBuffer. 73 */ 74 public class SourceLanguage : ObjectG 75 { 76 77 /** the main Gtk struct */ 78 protected GtkSourceLanguage* gtkSourceLanguage; 79 80 81 public GtkSourceLanguage* getSourceLanguageStruct() 82 { 83 return gtkSourceLanguage; 84 } 85 86 87 /** the main Gtk struct as a void* */ 88 protected override void* getStruct() 89 { 90 return cast(void*)gtkSourceLanguage; 91 } 92 93 /** 94 * Sets our main struct and passes it to the parent class 95 */ 96 public this (GtkSourceLanguage* gtkSourceLanguage) 97 { 98 super(cast(GObject*)gtkSourceLanguage); 99 this.gtkSourceLanguage = gtkSourceLanguage; 100 } 101 102 protected override void setStruct(GObject* obj) 103 { 104 super.setStruct(obj); 105 gtkSourceLanguage = cast(GtkSourceLanguage*)obj; 106 } 107 108 /** 109 */ 110 111 /** 112 * Returns the ID of the language. The ID is not locale-dependent. 113 * The returned string is owned by language and should not be freed 114 * or modified. 115 * Returns: the ID of language. 116 */ 117 public string getId() 118 { 119 // const gchar * gtk_source_language_get_id (GtkSourceLanguage *language); 120 return Str.toString(gtk_source_language_get_id(gtkSourceLanguage)); 121 } 122 123 /** 124 * Returns the localized name of the language. 125 * The returned string is owned by language and should not be freed 126 * or modified. 127 * Returns: the name of language. 128 */ 129 public string getName() 130 { 131 // const gchar * gtk_source_language_get_name (GtkSourceLanguage *language); 132 return Str.toString(gtk_source_language_get_name(gtkSourceLanguage)); 133 } 134 135 /** 136 * Returns the localized section of the language. 137 * Each language belong to a section (ex. HTML belogs to the 138 * Markup section). 139 * The returned string is owned by language and should not be freed 140 * or modified. 141 * Returns: the section of language. 142 */ 143 public string getSection() 144 { 145 // const gchar * gtk_source_language_get_section (GtkSourceLanguage *language); 146 return Str.toString(gtk_source_language_get_section(gtkSourceLanguage)); 147 } 148 149 /** 150 * Returns whether the language should be hidden from the user. 151 * Returns: TRUE if the language should be hidden, FALSE otherwise. 152 */ 153 public int getHidden() 154 { 155 // gboolean gtk_source_language_get_hidden (GtkSourceLanguage *language); 156 return gtk_source_language_get_hidden(gtkSourceLanguage); 157 } 158 159 /** 160 * Params: 161 * name = metadata property name. 162 * 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. 163 */ 164 public string getMetadata(string name) 165 { 166 // const gchar * gtk_source_language_get_metadata (GtkSourceLanguage *language, const gchar *name); 167 return Str.toString(gtk_source_language_get_metadata(gtkSourceLanguage, Str.toStringz(name))); 168 } 169 170 /** 171 * Returns the mime types associated to this language. This is just 172 * an utility wrapper around gtk_source_language_get_metadata() to 173 * retrieve the "mimetypes" metadata property and split it into an 174 * array. 175 * 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] 176 */ 177 public string[] getMimeTypes() 178 { 179 // gchar ** gtk_source_language_get_mime_types (GtkSourceLanguage *language); 180 return Str.toStringArray(gtk_source_language_get_mime_types(gtkSourceLanguage)); 181 } 182 183 /** 184 * Returns the globs associated to this language. This is just 185 * an utility wrapper around gtk_source_language_get_metadata() to 186 * retrieve the "globs" metadata property and split it into an array. 187 * 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] 188 */ 189 public string[] getGlobs() 190 { 191 // gchar ** gtk_source_language_get_globs (GtkSourceLanguage *language); 192 return Str.toStringArray(gtk_source_language_get_globs(gtkSourceLanguage)); 193 } 194 195 /** 196 * Returns the name of the style with ID style_id defined by this language. 197 * Params: 198 * styleId = a style ID. 199 * 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. 200 */ 201 public string getStyleName(string styleId) 202 { 203 // const gchar * gtk_source_language_get_style_name (GtkSourceLanguage *language, const gchar *style_id); 204 return Str.toString(gtk_source_language_get_style_name(gtkSourceLanguage, Str.toStringz(styleId))); 205 } 206 207 /** 208 * Returns the ids of the styles defined by this language. 209 * 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] 210 */ 211 public string[] getStyleIds() 212 { 213 // gchar ** gtk_source_language_get_style_ids (GtkSourceLanguage *language); 214 return Str.toStringArray(gtk_source_language_get_style_ids(gtkSourceLanguage)); 215 } 216 217 /** 218 * Returns the ID of the style to use if the specified style_id 219 * is not present in the current style scheme. 220 * Params: 221 * styleId = a style ID. 222 * 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 223 */ 224 public string getStyleFallback(string styleId) 225 { 226 // const gchar * gtk_source_language_get_style_fallback (GtkSourceLanguage *language, const gchar *style_id); 227 return Str.toString(gtk_source_language_get_style_fallback(gtkSourceLanguage, Str.toStringz(styleId))); 228 } 229 }