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.SpaceDrawer; 26 27 private import gio.Settings; 28 private import glib.ConstructionException; 29 private import glib.Str; 30 private import glib.Variant; 31 private import gobject.ObjectG; 32 private import gsvc.gsv; 33 public import gsvc.gsvtypes; 34 35 36 /** */ 37 public class SpaceDrawer : ObjectG 38 { 39 /** the main Gtk struct */ 40 protected GtkSourceSpaceDrawer* gtkSourceSpaceDrawer; 41 42 /** Get the main Gtk struct */ 43 public GtkSourceSpaceDrawer* getSpaceDrawerStruct() 44 { 45 return gtkSourceSpaceDrawer; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)gtkSourceSpaceDrawer; 52 } 53 54 protected override void setStruct(GObject* obj) 55 { 56 gtkSourceSpaceDrawer = cast(GtkSourceSpaceDrawer*)obj; 57 super.setStruct(obj); 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkSourceSpaceDrawer* gtkSourceSpaceDrawer, bool ownedRef = false) 64 { 65 this.gtkSourceSpaceDrawer = gtkSourceSpaceDrawer; 66 super(cast(GObject*)gtkSourceSpaceDrawer, ownedRef); 67 } 68 69 70 /** */ 71 public static GType getType() 72 { 73 return gtk_source_space_drawer_get_type(); 74 } 75 76 /** 77 * Creates a new #GtkSourceSpaceDrawer object. Useful for storing space drawing 78 * settings independently of a #GtkSourceView. 79 * 80 * Returns: a new #GtkSourceSpaceDrawer. 81 * 82 * Since: 3.24 83 * 84 * Throws: ConstructionException GTK+ fails to create the object. 85 */ 86 public this() 87 { 88 auto p = gtk_source_space_drawer_new(); 89 90 if(p is null) 91 { 92 throw new ConstructionException("null returned by new"); 93 } 94 95 this(cast(GtkSourceSpaceDrawer*) p, true); 96 } 97 98 /** 99 * Binds the #GtkSourceSpaceDrawer:matrix property to a #GSettings key. 100 * 101 * The #GSettings key must be of the same type as the 102 * #GtkSourceSpaceDrawer:matrix property, that is, `"au"`. 103 * 104 * The g_settings_bind() function cannot be used, because the default GIO 105 * mapping functions don't support #GVariant properties (maybe it will be 106 * supported by a future GIO version, in which case this function can be 107 * deprecated). 108 * 109 * Params: 110 * settings = a #GSettings object. 111 * key = the @settings key to bind. 112 * flags = flags for the binding. 113 * 114 * Since: 3.24 115 */ 116 public void bindMatrixSetting(Settings settings, string key, GSettingsBindFlags flags) 117 { 118 gtk_source_space_drawer_bind_matrix_setting(gtkSourceSpaceDrawer, (settings is null) ? null : settings.getSettingsStruct(), Str.toStringz(key), flags); 119 } 120 121 /** 122 * Returns: whether the #GtkSourceSpaceDrawer:matrix property is enabled. 123 * 124 * Since: 3.24 125 */ 126 public bool getEnableMatrix() 127 { 128 return gtk_source_space_drawer_get_enable_matrix(gtkSourceSpaceDrawer) != 0; 129 } 130 131 /** 132 * Gets the value of the #GtkSourceSpaceDrawer:matrix property, as a #GVariant. 133 * An empty array can be returned in case the matrix is a zero matrix. 134 * 135 * The gtk_source_space_drawer_get_types_for_locations() function may be more 136 * convenient to use. 137 * 138 * Returns: the #GtkSourceSpaceDrawer:matrix value as a new floating #GVariant 139 * instance. 140 * 141 * Since: 3.24 142 */ 143 public Variant getMatrix() 144 { 145 auto p = gtk_source_space_drawer_get_matrix(gtkSourceSpaceDrawer); 146 147 if(p is null) 148 { 149 return null; 150 } 151 152 return new Variant(cast(GVariant*) p, true); 153 } 154 155 /** 156 * If only one location is specified, this function returns what kind of 157 * white spaces are drawn at that location. The value is retrieved from the 158 * #GtkSourceSpaceDrawer:matrix property. 159 * 160 * If several locations are specified, this function returns the logical AND for 161 * those locations. Which means that if a certain kind of white space is present 162 * in the return value, then that kind of white space is drawn at all the 163 * specified @locations. 164 * 165 * Params: 166 * locations = one or several #GtkSourceSpaceLocationFlags. 167 * 168 * Returns: a combination of #GtkSourceSpaceTypeFlags. 169 * 170 * Since: 3.24 171 */ 172 public GtkSourceSpaceTypeFlags getTypesForLocations(GtkSourceSpaceLocationFlags locations) 173 { 174 return gtk_source_space_drawer_get_types_for_locations(gtkSourceSpaceDrawer, locations); 175 } 176 177 /** 178 * Sets whether the #GtkSourceSpaceDrawer:matrix property is enabled. 179 * 180 * Params: 181 * enableMatrix = the new value. 182 * 183 * Since: 3.24 184 */ 185 public void setEnableMatrix(bool enableMatrix) 186 { 187 gtk_source_space_drawer_set_enable_matrix(gtkSourceSpaceDrawer, enableMatrix); 188 } 189 190 /** 191 * Sets a new value to the #GtkSourceSpaceDrawer:matrix property, as a 192 * #GVariant. If @matrix is %NULL, then an empty array is set. 193 * 194 * If @matrix is floating, it is consumed. 195 * 196 * The gtk_source_space_drawer_set_types_for_locations() function may be more 197 * convenient to use. 198 * 199 * Params: 200 * matrix = the new matrix value, or %NULL. 201 * 202 * Since: 3.24 203 */ 204 public void setMatrix(Variant matrix) 205 { 206 gtk_source_space_drawer_set_matrix(gtkSourceSpaceDrawer, (matrix is null) ? null : matrix.getVariantStruct()); 207 } 208 209 /** 210 * Modifies the #GtkSourceSpaceDrawer:matrix property at the specified 211 * @locations. 212 * 213 * Params: 214 * locations = one or several #GtkSourceSpaceLocationFlags. 215 * types = a combination of #GtkSourceSpaceTypeFlags. 216 * 217 * Since: 3.24 218 */ 219 public void setTypesForLocations(GtkSourceSpaceLocationFlags locations, GtkSourceSpaceTypeFlags types) 220 { 221 gtk_source_space_drawer_set_types_for_locations(gtkSourceSpaceDrawer, locations, types); 222 } 223 }