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