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.SourceStyleSchemeManager; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gsv.SourceStyleScheme; 31 private import gsv.c.functions; 32 public import gsv.c.types; 33 public import gsvc.gsvtypes; 34 35 36 /** */ 37 public class SourceStyleSchemeManager : ObjectG 38 { 39 /** the main Gtk struct */ 40 protected GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager; 41 42 /** Get the main Gtk struct */ 43 public GtkSourceStyleSchemeManager* getSourceStyleSchemeManagerStruct(bool transferOwnership = false) 44 { 45 if (transferOwnership) 46 ownedRef = false; 47 return gtkSourceStyleSchemeManager; 48 } 49 50 /** the main Gtk struct as a void* */ 51 protected override void* getStruct() 52 { 53 return cast(void*)gtkSourceStyleSchemeManager; 54 } 55 56 /** 57 * Sets our main struct and passes it to the parent class. 58 */ 59 public this (GtkSourceStyleSchemeManager* gtkSourceStyleSchemeManager, bool ownedRef = false) 60 { 61 this.gtkSourceStyleSchemeManager = gtkSourceStyleSchemeManager; 62 super(cast(GObject*)gtkSourceStyleSchemeManager, ownedRef); 63 } 64 65 66 /** */ 67 public static GType getType() 68 { 69 return gtk_source_style_scheme_manager_get_type(); 70 } 71 72 /** 73 * Creates a new style manager. If you do not need more than one style 74 * manager then use gtk_source_style_scheme_manager_get_default() instead. 75 * 76 * Returns: a new #GtkSourceStyleSchemeManager. 77 * 78 * Throws: ConstructionException GTK+ fails to create the object. 79 */ 80 public this() 81 { 82 auto p = gtk_source_style_scheme_manager_new(); 83 84 if(p is null) 85 { 86 throw new ConstructionException("null returned by new"); 87 } 88 89 this(cast(GtkSourceStyleSchemeManager*) p, true); 90 } 91 92 /** 93 * Returns the default #GtkSourceStyleSchemeManager instance. 94 * 95 * Returns: a #GtkSourceStyleSchemeManager. Return value 96 * is owned by GtkSourceView library and must not be unref'ed. 97 */ 98 public static SourceStyleSchemeManager getDefault() 99 { 100 auto p = gtk_source_style_scheme_manager_get_default(); 101 102 if(p is null) 103 { 104 return null; 105 } 106 107 return ObjectG.getDObject!(SourceStyleSchemeManager)(cast(GtkSourceStyleSchemeManager*) p); 108 } 109 110 /** 111 * Appends @path to the list of directories where the @manager looks for 112 * style scheme files. 113 * See gtk_source_style_scheme_manager_set_search_path() for details. 114 * 115 * Params: 116 * path = a directory or a filename. 117 */ 118 public void appendSearchPath(string path) 119 { 120 gtk_source_style_scheme_manager_append_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path)); 121 } 122 123 /** 124 * Mark any currently cached information about the available style scehems 125 * as invalid. All the available style schemes will be reloaded next time 126 * the @manager is accessed. 127 */ 128 public void forceRescan() 129 { 130 gtk_source_style_scheme_manager_force_rescan(gtkSourceStyleSchemeManager); 131 } 132 133 /** 134 * Looks up style scheme by id. 135 * 136 * Params: 137 * schemeId = style scheme id to find. 138 * 139 * Returns: a #GtkSourceStyleScheme object. Returned value is owned by 140 * @manager and must not be unref'ed. 141 */ 142 public SourceStyleScheme getScheme(string schemeId) 143 { 144 auto p = gtk_source_style_scheme_manager_get_scheme(gtkSourceStyleSchemeManager, Str.toStringz(schemeId)); 145 146 if(p is null) 147 { 148 return null; 149 } 150 151 return ObjectG.getDObject!(SourceStyleScheme)(cast(GtkSourceStyleScheme*) p); 152 } 153 154 /** 155 * Returns the ids of the available style schemes. 156 * 157 * Returns: a %NULL-terminated array of strings containing the ids of the available 158 * style schemes or %NULL if no style scheme is available. 159 * The array is sorted alphabetically according to the scheme name. 160 * The array is owned by the @manager and must not be modified. 161 */ 162 public string[] getSchemeIds() 163 { 164 return Str.toStringArray(gtk_source_style_scheme_manager_get_scheme_ids(gtkSourceStyleSchemeManager)); 165 } 166 167 /** 168 * Returns the current search path for the @manager. 169 * See gtk_source_style_scheme_manager_set_search_path() for details. 170 * 171 * Returns: a %NULL-terminated array 172 * of string containing the search path. 173 * The array is owned by the @manager and must not be modified. 174 */ 175 public string[] getSearchPath() 176 { 177 return Str.toStringArray(gtk_source_style_scheme_manager_get_search_path(gtkSourceStyleSchemeManager)); 178 } 179 180 /** 181 * Prepends @path to the list of directories where the @manager looks 182 * for style scheme files. 183 * See gtk_source_style_scheme_manager_set_search_path() for details. 184 * 185 * Params: 186 * path = a directory or a filename. 187 */ 188 public void prependSearchPath(string path) 189 { 190 gtk_source_style_scheme_manager_prepend_search_path(gtkSourceStyleSchemeManager, Str.toStringz(path)); 191 } 192 193 /** 194 * Sets the list of directories where the @manager looks for 195 * style scheme files. 196 * If @path is %NULL, the search path is reset to default. 197 * 198 * Params: 199 * path = a %NULL-terminated array of strings or %NULL. 200 */ 201 public void setSearchPath(string[] path) 202 { 203 gtk_source_style_scheme_manager_set_search_path(gtkSourceStyleSchemeManager, Str.toStringzArray(path)); 204 } 205 }