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() 41 { 42 return gtkSourceLanguage; 43 } 44 45 /** the main Gtk struct as a void* */ 46 protected override void* getStruct() 47 { 48 return cast(void*)gtkSourceLanguage; 49 } 50 51 protected override void setStruct(GObject* obj) 52 { 53 gtkSourceLanguage = cast(GtkSourceLanguage*)obj; 54 super.setStruct(obj); 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (GtkSourceLanguage* gtkSourceLanguage, bool ownedRef = false) 61 { 62 this.gtkSourceLanguage = gtkSourceLanguage; 63 super(cast(GObject*)gtkSourceLanguage, ownedRef); 64 } 65 66 67 /** */ 68 public static GType getType() 69 { 70 return gtk_source_language_get_type(); 71 } 72 73 /** 74 * Returns the globs associated to this language. This is just 75 * an utility wrapper around gtk_source_language_get_metadata() to 76 * retrieve the "globs" metadata property and split it into an array. 77 * 78 * Return: a newly-allocated %NULL terminated array containing the globs or %NULL 79 * if no globs are found. 80 * The returned array must be freed with g_strfreev(). 81 */ 82 public string[] getGlobs() 83 { 84 return Str.toStringArray(gtk_source_language_get_globs(gtkSourceLanguage)); 85 } 86 87 /** 88 * Returns whether the language should be hidden from the user. 89 * 90 * Return: %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 * Return: 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 * Return: 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 * Return: 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 return Str.toStringArray(gtk_source_language_get_mime_types(gtkSourceLanguage)); 137 } 138 139 /** 140 * Returns the localized name of the language. 141 * The returned string is owned by @language and should not be freed 142 * or modified. 143 * 144 * Return: the name of @language. 145 */ 146 public string getName() 147 { 148 return Str.toString(gtk_source_language_get_name(gtkSourceLanguage)); 149 } 150 151 /** 152 * Returns the localized section of the language. 153 * Each language belong to a section (ex. HTML belogs to the 154 * Markup section). 155 * The returned string is owned by @language and should not be freed 156 * or modified. 157 * 158 * Return: the section of @language. 159 */ 160 public string getSection() 161 { 162 return Str.toString(gtk_source_language_get_section(gtkSourceLanguage)); 163 } 164 165 /** 166 * Returns the ID of the style to use if the specified @style_id 167 * is not present in the current style scheme. 168 * 169 * Params: 170 * styleId = a style ID. 171 * 172 * Return: the ID of the style to use if the 173 * specified @style_id is not present in the current style scheme or %NULL 174 * if the style has no fallback defined. 175 * The returned string is owned by the @language and must not be modified. 176 * 177 * Since: 3.4 178 */ 179 public string getStyleFallback(string styleId) 180 { 181 return Str.toString(gtk_source_language_get_style_fallback(gtkSourceLanguage, Str.toStringz(styleId))); 182 } 183 184 /** 185 * Returns the ids of the styles defined by this @language. 186 * 187 * Return: a newly-allocated %NULL terminated array containing ids of the 188 * styles defined by this @language or %NULL if no style is defined. 189 * The returned array must be freed with g_strfreev(). 190 */ 191 public string[] getStyleIds() 192 { 193 return Str.toStringArray(gtk_source_language_get_style_ids(gtkSourceLanguage)); 194 } 195 196 /** 197 * Returns the name of the style with ID @style_id defined by this @language. 198 * 199 * Params: 200 * styleId = a style ID. 201 * 202 * Return: the name of the style with ID @style_id 203 * defined by this @language or %NULL if the style has no name or there is no 204 * style with ID @style_id defined by this @language. 205 * The returned string is owned by the @language and must not be modified. 206 */ 207 public string getStyleName(string styleId) 208 { 209 return Str.toString(gtk_source_language_get_style_name(gtkSourceLanguage, Str.toStringz(styleId))); 210 } 211 }