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