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