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 public class SourceLanguage : ObjectG 34 { 35 /** the main Gtk struct */ 36 protected GtkSourceLanguage* gtkSourceLanguage; 37 38 /** Get the main Gtk struct */ 39 public GtkSourceLanguage* getSourceLanguageStruct() 40 { 41 return gtkSourceLanguage; 42 } 43 44 /** the main Gtk struct as a void* */ 45 protected override void* getStruct() 46 { 47 return cast(void*)gtkSourceLanguage; 48 } 49 50 protected override void setStruct(GObject* obj) 51 { 52 gtkSourceLanguage = cast(GtkSourceLanguage*)obj; 53 super.setStruct(obj); 54 } 55 56 /** 57 * Sets our main struct and passes it to the parent class. 58 */ 59 public this (GtkSourceLanguage* gtkSourceLanguage, bool ownedRef = false) 60 { 61 this.gtkSourceLanguage = gtkSourceLanguage; 62 super(cast(GObject*)gtkSourceLanguage, ownedRef); 63 } 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 79 * %NULL terminated array containing the globs or %NULL 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 the metadata of @language 114 * or %NULL if language doesn't contain that metadata property. 115 * The returned string is owned by @language and should not be freed 116 * or modified. 117 */ 118 public string getMetadata(string name) 119 { 120 return Str.toString(gtk_source_language_get_metadata(gtkSourceLanguage, Str.toStringz(name))); 121 } 122 123 /** 124 * Returns the mime types associated to this language. This is just 125 * an utility wrapper around gtk_source_language_get_metadata() to 126 * retrieve the "mimetypes" metadata property and split it into an 127 * array. 128 * 129 * Return: a newly-allocated 130 * %NULL terminated array containing the mime types or %NULL if no 131 * 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 specified @style_id 173 * is not present in the current style scheme or %NULL if the style has 174 * 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 %NULL terminated 188 * array containing ids of the styles defined by this @language or 189 * %NULL if no style is defined. 190 * The returned array must be freed with g_strfreev(). 191 */ 192 public string[] getStyleIds() 193 { 194 return Str.toStringArray(gtk_source_language_get_style_ids(gtkSourceLanguage)); 195 } 196 197 /** 198 * Returns the name of the style with ID @style_id defined by this @language. 199 * 200 * Params: 201 * styleId = a style ID. 202 * 203 * Return: the name of the style with ID @style_id defined by this @language or 204 * %NULL if the style has no name or there is no style with ID @style_id defined 205 * by this @language. The returned string is owned by the @language and must 206 * not be modified. 207 */ 208 public string getStyleName(string styleId) 209 { 210 return Str.toString(gtk_source_language_get_style_name(gtkSourceLanguage, Str.toStringz(styleId))); 211 } 212 }