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