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  * Conversion parameters:
26  * inFile  = GtkSettings.html
27  * outPack = gtk
28  * outFile = Settings
29  * strct   = GtkSettings
30  * realStrct=
31  * ctorStrct=
32  * clss    = Settings
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- StyleProviderIF
40  * prefixes:
41  * 	- gtk_settings_
42  * 	- gtk_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * 	- glib.Str
49  * 	- gobject.ParamSpec
50  * 	- gobject.Value
51  * 	- glib.StringG
52  * 	- gdk.Screen
53  * 	- gtk.StyleProviderT
54  * 	- gtk.StyleProviderIF
55  * structWrap:
56  * 	- GParamSpec* -> ParamSpec
57  * 	- GString* -> StringG
58  * 	- GValue* -> Value
59  * 	- GdkScreen* -> Screen
60  * 	- GtkSettings* -> Settings
61  * module aliases:
62  * local aliases:
63  * overrides:
64  */
65 
66 module gtk.Settings;
67 
68 public  import gtkc.gtktypes;
69 
70 private import gtkc.gtk;
71 private import glib.ConstructionException;
72 private import gobject.ObjectG;
73 
74 private import glib.Str;
75 private import gobject.ParamSpec;
76 private import gobject.Value;
77 private import glib.StringG;
78 private import gdk.Screen;
79 private import gtk.StyleProviderT;
80 private import gtk.StyleProviderIF;
81 
82 
83 private import gobject.ObjectG;
84 
85 /**
86  * GtkSettings provide a mechanism to share global settings between
87  * applications.
88  *
89  * On the X window system, this sharing is realized by an
90  * XSettings
91  * manager that is usually part of the desktop environment, along with
92  * utilities that let the user change these settings. In the absence of
93  * an Xsettings manager, GTK+ reads default values for settings from
94  * settings.ini files in
95  * /etc/gtk-3.0, $XDG_CONFIG_DIRS/gtk-3.0
96  * and $XDG_CONFIG_HOME/gtk-3.0.
97  * These files must be valid key files (see GKeyFile), and have
98  * a section called Settings. Themes can also provide default values
99  * for settings by installing a settings.ini file
100  * next to their gtk.css file.
101  *
102  * Applications can override system-wide settings with
103  * gtk_settings_set_string_property(), gtk_settings_set_long_property(),
104  * etc. This should be restricted to special cases though; GtkSettings are
105  * not meant as an application configuration facility. When doing so, you
106  * need to be aware that settings that are specific to individual widgets
107  * may not be available before the widget type has been realized at least
108  * once. The following example demonstrates a way to do this:
109  *
110  * $(DDOC_COMMENT example)
111  *
112  * There is one GtkSettings instance per screen. It can be obtained with
113  * gtk_settings_get_for_screen(), but in many cases, it is more convenient
114  * to use gtk_widget_get_settings(). gtk_settings_get_default() returns the
115  * GtkSettings instance for the default screen.
116  */
117 public class Settings : ObjectG, StyleProviderIF
118 {
119 	
120 	/** the main Gtk struct */
121 	protected GtkSettings* gtkSettings;
122 	
123 	
124 	/** Get the main Gtk struct */
125 	public GtkSettings* getSettingsStruct()
126 	{
127 		return gtkSettings;
128 	}
129 	
130 	
131 	/** the main Gtk struct as a void* */
132 	protected override void* getStruct()
133 	{
134 		return cast(void*)gtkSettings;
135 	}
136 	
137 	/**
138 	 * Sets our main struct and passes it to the parent class
139 	 */
140 	public this (GtkSettings* gtkSettings)
141 	{
142 		super(cast(GObject*)gtkSettings);
143 		this.gtkSettings = gtkSettings;
144 	}
145 	
146 	protected override void setStruct(GObject* obj)
147 	{
148 		super.setStruct(obj);
149 		gtkSettings = cast(GtkSettings*)obj;
150 	}
151 	
152 	// add the StyleProvider capabilities
153 	mixin StyleProviderT!(GtkSettings);
154 	
155 	/**
156 	 */
157 	
158 	/**
159 	 * Gets the GtkSettings object for the default GDK screen, creating
160 	 * it if necessary. See gtk_settings_get_for_screen().
161 	 * Returns: a GtkSettings object. If there is no default screen, then returns NULL. [transfer none]
162 	 */
163 	public static Settings getDefault()
164 	{
165 		// GtkSettings * gtk_settings_get_default (void);
166 		auto p = gtk_settings_get_default();
167 		
168 		if(p is null)
169 		{
170 			return null;
171 		}
172 		
173 		return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p);
174 	}
175 	
176 	/**
177 	 * Gets the GtkSettings object for screen, creating it if necessary.
178 	 * Since 2.2
179 	 * Params:
180 	 * screen = a GdkScreen.
181 	 * Returns: a GtkSettings object. [transfer none]
182 	 */
183 	public static Settings getForScreen(Screen screen)
184 	{
185 		// GtkSettings * gtk_settings_get_for_screen (GdkScreen *screen);
186 		auto p = gtk_settings_get_for_screen((screen is null) ? null : screen.getScreenStruct());
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p);
194 	}
195 	
196 	/**
197 	 */
198 	public static void installProperty(ParamSpec pspec)
199 	{
200 		// void gtk_settings_install_property (GParamSpec *pspec);
201 		gtk_settings_install_property((pspec is null) ? null : pspec.getParamSpecStruct());
202 	}
203 	
204 	/**
205 	 * Params:
206 	 * parser = . [scope call]
207 	 */
208 	public static void installPropertyParser(ParamSpec pspec, GtkRcPropertyParser parser)
209 	{
210 		// void gtk_settings_install_property_parser  (GParamSpec *pspec,  GtkRcPropertyParser parser);
211 		gtk_settings_install_property_parser((pspec is null) ? null : pspec.getParamSpecStruct(), parser);
212 	}
213 	
214 	/**
215 	 * A GtkRcPropertyParser for use with gtk_settings_install_property_parser()
216 	 * or gtk_widget_class_install_style_property_parser() which parses a
217 	 * color given either by its name or in the form
218 	 * { red, green, blue } where red, green and
219 	 * blue are integers between 0 and 65535 or floating-point numbers
220 	 * between 0 and 1.
221 	 * Params:
222 	 * pspec = a GParamSpec
223 	 * gstring = the GString to be parsed
224 	 * propertyValue = a GValue which must hold GdkColor values.
225 	 * Returns: TRUE if gstring could be parsed and property_value has been set to the resulting GdkColor.
226 	 */
227 	public static int rcPropertyParseColor(ParamSpec pspec, StringG gstring, Value propertyValue)
228 	{
229 		// gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,  const GString *gstring,  GValue *property_value);
230 		return gtk_rc_property_parse_color((pspec is null) ? null : pspec.getParamSpecStruct(), (gstring is null) ? null : gstring.getStringGStruct(), (propertyValue is null) ? null : propertyValue.getValueStruct());
231 	}
232 	
233 	/**
234 	 * A GtkRcPropertyParser for use with gtk_settings_install_property_parser()
235 	 * or gtk_widget_class_install_style_property_parser() which parses a single
236 	 * enumeration value.
237 	 * The enumeration value can be specified by its name, its nickname or
238 	 * its numeric value. For consistency with flags parsing, the value
239 	 * may be surrounded by parentheses.
240 	 * Params:
241 	 * pspec = a GParamSpec
242 	 * gstring = the GString to be parsed
243 	 * propertyValue = a GValue which must hold enum values.
244 	 * Returns: TRUE if gstring could be parsed and property_value has been set to the resulting GEnumValue.
245 	 */
246 	public static int rcPropertyParseEnum(ParamSpec pspec, StringG gstring, Value propertyValue)
247 	{
248 		// gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,  const GString *gstring,  GValue *property_value);
249 		return gtk_rc_property_parse_enum((pspec is null) ? null : pspec.getParamSpecStruct(), (gstring is null) ? null : gstring.getStringGStruct(), (propertyValue is null) ? null : propertyValue.getValueStruct());
250 	}
251 	
252 	/**
253 	 * A GtkRcPropertyParser for use with gtk_settings_install_property_parser()
254 	 * or gtk_widget_class_install_style_property_parser() which parses flags.
255 	 * Flags can be specified by their name, their nickname or
256 	 * numerically. Multiple flags can be specified in the form
257 	 * "( flag1 | flag2 | ... )".
258 	 * Params:
259 	 * pspec = a GParamSpec
260 	 * gstring = the GString to be parsed
261 	 * propertyValue = a GValue which must hold flags values.
262 	 * Returns: TRUE if gstring could be parsed and property_value has been set to the resulting flags value.
263 	 */
264 	public static int rcPropertyParseFlags(ParamSpec pspec, StringG gstring, Value propertyValue)
265 	{
266 		// gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,  const GString *gstring,  GValue *property_value);
267 		return gtk_rc_property_parse_flags((pspec is null) ? null : pspec.getParamSpecStruct(), (gstring is null) ? null : gstring.getStringGStruct(), (propertyValue is null) ? null : propertyValue.getValueStruct());
268 	}
269 	
270 	/**
271 	 * A GtkRcPropertyParser for use with gtk_settings_install_property_parser()
272 	 * or gtk_widget_class_install_style_property_parser() which parses a
273 	 * requisition in the form
274 	 * "{ width, height }" for integers width and height.
275 	 * Params:
276 	 * pspec = a GParamSpec
277 	 * gstring = the GString to be parsed
278 	 * propertyValue = a GValue which must hold boxed values.
279 	 * Returns: TRUE if gstring could be parsed and property_value has been set to the resulting GtkRequisition.
280 	 */
281 	public static int rcPropertyParseRequisition(ParamSpec pspec, StringG gstring, Value propertyValue)
282 	{
283 		// gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,  const GString *gstring,  GValue *property_value);
284 		return gtk_rc_property_parse_requisition((pspec is null) ? null : pspec.getParamSpecStruct(), (gstring is null) ? null : gstring.getStringGStruct(), (propertyValue is null) ? null : propertyValue.getValueStruct());
285 	}
286 	
287 	/**
288 	 * A GtkRcPropertyParser for use with gtk_settings_install_property_parser()
289 	 * or gtk_widget_class_install_style_property_parser() which parses
290 	 * borders in the form
291 	 * "{ left, right, top, bottom }" for integers
292 	 * left, right, top and bottom.
293 	 * Params:
294 	 * pspec = a GParamSpec
295 	 * gstring = the GString to be parsed
296 	 * propertyValue = a GValue which must hold boxed values.
297 	 * Returns: TRUE if gstring could be parsed and property_value has been set to the resulting GtkBorder.
298 	 */
299 	public static int rcPropertyParseBorder(ParamSpec pspec, StringG gstring, Value propertyValue)
300 	{
301 		// gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,  const GString *gstring,  GValue *property_value);
302 		return gtk_rc_property_parse_border((pspec is null) ? null : pspec.getParamSpecStruct(), (gstring is null) ? null : gstring.getStringGStruct(), (propertyValue is null) ? null : propertyValue.getValueStruct());
303 	}
304 	
305 	/**
306 	 */
307 	public void setPropertyValue(string name, out GtkSettingsValue svalue)
308 	{
309 		// void gtk_settings_set_property_value (GtkSettings *settings,  const gchar *name,  const GtkSettingsValue *svalue);
310 		gtk_settings_set_property_value(gtkSettings, Str.toStringz(name), &svalue);
311 	}
312 	
313 	/**
314 	 */
315 	public void setStringProperty(string name, string vString, string origin)
316 	{
317 		// void gtk_settings_set_string_property (GtkSettings *settings,  const gchar *name,  const gchar *v_string,  const gchar *origin);
318 		gtk_settings_set_string_property(gtkSettings, Str.toStringz(name), Str.toStringz(vString), Str.toStringz(origin));
319 	}
320 	
321 	/**
322 	 */
323 	public void setLongProperty(string name, glong vLong, string origin)
324 	{
325 		// void gtk_settings_set_long_property (GtkSettings *settings,  const gchar *name,  glong v_long,  const gchar *origin);
326 		gtk_settings_set_long_property(gtkSettings, Str.toStringz(name), vLong, Str.toStringz(origin));
327 	}
328 	
329 	/**
330 	 */
331 	public void setDoubleProperty(string name, double vDouble, string origin)
332 	{
333 		// void gtk_settings_set_double_property (GtkSettings *settings,  const gchar *name,  gdouble v_double,  const gchar *origin);
334 		gtk_settings_set_double_property(gtkSettings, Str.toStringz(name), vDouble, Str.toStringz(origin));
335 	}
336 }