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