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 gtk.Settings; 26 27 private import gdk.Screen; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.ParamSpec; 31 private import gtk.StyleProviderIF; 32 private import gtk.StyleProviderT; 33 private import gtkc.gtk; 34 public import gtkc.gtktypes; 35 36 37 /** 38 * GtkSettings provide a mechanism to share global settings between 39 * applications. 40 * 41 * On the X window system, this sharing is realized by an 42 * [XSettings](http://www.freedesktop.org/wiki/Specifications/xsettings-spec) 43 * manager that is usually part of the desktop environment, along with 44 * utilities that let the user change these settings. In the absence of 45 * an Xsettings manager, GTK+ reads default values for settings from 46 * `settings.ini` files in 47 * `/etc/gtk-3.0`, `$XDG_CONFIG_DIRS/gtk-3.0` 48 * and `$XDG_CONFIG_HOME/gtk-3.0`. 49 * These files must be valid key files (see #GKeyFile), and have 50 * a section called Settings. Themes can also provide default values 51 * for settings by installing a `settings.ini` file 52 * next to their `gtk.css` file. 53 * 54 * Applications can override system-wide settings by setting the property 55 * of the GtkSettings object with g_object_set(). This should be restricted 56 * to special cases though; GtkSettings are not meant as an application 57 * configuration facility. When doing so, you need to be aware that settings 58 * that are specific to individual widgets may not be available before the 59 * widget type has been realized at least once. The following example 60 * demonstrates a way to do this: 61 * |[<!-- language="C" --> 62 * gtk_init (&argc, &argv); 63 * 64 * // make sure the type is realized 65 * g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM)); 66 * 67 * g_object_set (gtk_settings_get_default (), "gtk-enable-animations", FALSE, NULL); 68 * ]| 69 * 70 * There is one GtkSettings instance per screen. It can be obtained with 71 * gtk_settings_get_for_screen(), but in many cases, it is more convenient 72 * to use gtk_widget_get_settings(). gtk_settings_get_default() returns the 73 * GtkSettings instance for the default screen. 74 */ 75 public class Settings : ObjectG, StyleProviderIF 76 { 77 /** the main Gtk struct */ 78 protected GtkSettings* gtkSettings; 79 80 /** Get the main Gtk struct */ 81 public GtkSettings* getSettingsStruct() 82 { 83 return gtkSettings; 84 } 85 86 /** the main Gtk struct as a void* */ 87 protected override void* getStruct() 88 { 89 return cast(void*)gtkSettings; 90 } 91 92 protected override void setStruct(GObject* obj) 93 { 94 gtkSettings = cast(GtkSettings*)obj; 95 super.setStruct(obj); 96 } 97 98 /** 99 * Sets our main struct and passes it to the parent class. 100 */ 101 public this (GtkSettings* gtkSettings, bool ownedRef = false) 102 { 103 this.gtkSettings = gtkSettings; 104 super(cast(GObject*)gtkSettings, ownedRef); 105 } 106 107 // add the StyleProvider capabilities 108 mixin StyleProviderT!(GtkSettings); 109 110 111 /** */ 112 public static GType getType() 113 { 114 return gtk_settings_get_type(); 115 } 116 117 /** 118 * Gets the #GtkSettings object for the default GDK screen, creating 119 * it if necessary. See gtk_settings_get_for_screen(). 120 * 121 * Return: a #GtkSettings object. If there is 122 * no default screen, then returns %NULL. 123 */ 124 public static Settings getDefault() 125 { 126 auto p = gtk_settings_get_default(); 127 128 if(p is null) 129 { 130 return null; 131 } 132 133 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p); 134 } 135 136 /** 137 * Gets the #GtkSettings object for @screen, creating it if necessary. 138 * 139 * Params: 140 * screen = a #GdkScreen. 141 * 142 * Return: a #GtkSettings object. 143 * 144 * Since: 2.2 145 */ 146 public static Settings getForScreen(Screen screen) 147 { 148 auto p = gtk_settings_get_for_screen((screen is null) ? null : screen.getScreenStruct()); 149 150 if(p is null) 151 { 152 return null; 153 } 154 155 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) p); 156 } 157 158 /** 159 * 160 * 161 * Deprecated: This function is not useful outside GTK+. 162 */ 163 public static void installProperty(ParamSpec pspec) 164 { 165 gtk_settings_install_property((pspec is null) ? null : pspec.getParamSpecStruct()); 166 } 167 168 /** 169 * 170 * 171 * Deprecated: This function is not useful outside GTK+. 172 */ 173 public static void installPropertyParser(ParamSpec pspec, GtkRcPropertyParser parser) 174 { 175 gtk_settings_install_property_parser((pspec is null) ? null : pspec.getParamSpecStruct(), parser); 176 } 177 178 /** 179 * Undoes the effect of calling g_object_set() to install an 180 * application-specific value for a setting. After this call, 181 * the setting will again follow the session-wide value for 182 * this setting. 183 * 184 * Params: 185 * name = the name of the setting to reset 186 * 187 * Since: 3.20 188 */ 189 public void resetProperty(string name) 190 { 191 gtk_settings_reset_property(gtkSettings, Str.toStringz(name)); 192 } 193 194 /** 195 * 196 * 197 * Deprecated: Use g_object_set() instead. 198 */ 199 public void setDoubleProperty(string name, double vDouble, string origin) 200 { 201 gtk_settings_set_double_property(gtkSettings, Str.toStringz(name), vDouble, Str.toStringz(origin)); 202 } 203 204 /** 205 * 206 * 207 * Deprecated: Use g_object_set() instead. 208 */ 209 public void setLongProperty(string name, glong vLong, string origin) 210 { 211 gtk_settings_set_long_property(gtkSettings, Str.toStringz(name), vLong, Str.toStringz(origin)); 212 } 213 214 /** 215 * 216 * 217 * Deprecated: Use g_object_set() instead. 218 */ 219 public void setPropertyValue(string name, GtkSettingsValue* svalue) 220 { 221 gtk_settings_set_property_value(gtkSettings, Str.toStringz(name), svalue); 222 } 223 224 /** 225 * 226 * 227 * Deprecated: Use g_object_set() instead. 228 */ 229 public void setStringProperty(string name, string vString, string origin) 230 { 231 gtk_settings_set_string_property(gtkSettings, Str.toStringz(name), Str.toStringz(vString), Str.toStringz(origin)); 232 } 233 }