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