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.Display; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gtk.StyleProviderIF; 31 private import gtk.StyleProviderT; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 35 36 /** 37 * `GtkSettings` provides a mechanism to share global settings between 38 * applications. 39 * 40 * On the X window system, this sharing is realized by an 41 * [XSettings](http://www.freedesktop.org/wiki/Specifications/xsettings-spec) 42 * manager that is usually part of the desktop environment, along with 43 * utilities that let the user change these settings. 44 * 45 * On Wayland, the settings are obtained either via a settings portal, 46 * or by reading desktop settings from DConf. 47 * 48 * In the absence of these sharing mechanisms, GTK reads default values for 49 * settings from `settings.ini` files in `/etc/gtk-4.0`, `$XDG_CONFIG_DIRS/gtk-4.0` 50 * and `$XDG_CONFIG_HOME/gtk-4.0`. These files must be valid key files (see 51 * `GKeyFile`), and have a section called Settings. Themes can also provide 52 * default values for settings by installing a `settings.ini` file 53 * next to their `gtk.css` file. 54 * 55 * Applications can override system-wide settings by setting the property 56 * of the `GtkSettings` object with g_object_set(). This should be restricted 57 * to special cases though; `GtkSettings` are not meant as an application 58 * configuration facility. 59 * 60 * There is one `GtkSettings` instance per display. It can be obtained with 61 * [type_func@GtkSettings.get_for_display], but in many cases, it is more 62 * convenient to use [method@Gtk.Widget.get_settings]. 63 */ 64 public class Settings : ObjectG, StyleProviderIF 65 { 66 /** the main Gtk struct */ 67 protected GtkSettings* gtkSettings; 68 69 /** Get the main Gtk struct */ 70 public GtkSettings* getSettingsStruct(bool transferOwnership = false) 71 { 72 if (transferOwnership) 73 ownedRef = false; 74 return gtkSettings; 75 } 76 77 /** the main Gtk struct as a void* */ 78 protected override void* getStruct() 79 { 80 return cast(void*)gtkSettings; 81 } 82 83 /** 84 * Sets our main struct and passes it to the parent class. 85 */ 86 public this (GtkSettings* gtkSettings, bool ownedRef = false) 87 { 88 this.gtkSettings = gtkSettings; 89 super(cast(GObject*)gtkSettings, ownedRef); 90 } 91 92 // add the StyleProvider capabilities 93 mixin StyleProviderT!(GtkSettings); 94 95 96 /** */ 97 public static GType getType() 98 { 99 return gtk_settings_get_type(); 100 } 101 102 /** 103 * Gets the `GtkSettings` object for the default display, creating 104 * it if necessary. 105 * 106 * See [type_func@Gtk.Settings.get_for_display]. 107 * 108 * Returns: a `GtkSettings` object. If there is 109 * no default display, then returns %NULL. 110 */ 111 public static Settings getDefault() 112 { 113 auto __p = gtk_settings_get_default(); 114 115 if(__p is null) 116 { 117 return null; 118 } 119 120 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) __p); 121 } 122 123 /** 124 * Gets the `GtkSettings` object for @display, creating it if necessary. 125 * 126 * Params: 127 * display = a `GdkDisplay` 128 * 129 * Returns: a `GtkSettings` object 130 */ 131 public static Settings getForDisplay(Display display) 132 { 133 auto __p = gtk_settings_get_for_display((display is null) ? null : display.getDisplayStruct()); 134 135 if(__p is null) 136 { 137 return null; 138 } 139 140 return ObjectG.getDObject!(Settings)(cast(GtkSettings*) __p); 141 } 142 143 /** 144 * Undoes the effect of calling g_object_set() to install an 145 * application-specific value for a setting. 146 * 147 * After this call, the setting will again follow the session-wide 148 * value for this setting. 149 * 150 * Params: 151 * name = the name of the setting to reset 152 */ 153 public void resetProperty(string name) 154 { 155 gtk_settings_reset_property(gtkSettings, Str.toStringz(name)); 156 } 157 }