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