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.StyleProviderT; 26 27 public import gobject.ObjectG; 28 public import gobject.ParamSpec; 29 public import gobject.Value; 30 public import gtk.IconFactory; 31 public import gtk.StyleProperties; 32 public import gtk.WidgetPath; 33 public import gtkc.gtk; 34 public import gtkc.gtktypes; 35 36 37 /** 38 * GtkStyleProvider is an interface used to provide style information to a #GtkStyleContext. 39 * See gtk_style_context_add_provider() and gtk_style_context_add_provider_for_screen(). 40 */ 41 public template StyleProviderT(TStruct) 42 { 43 /** Get the main Gtk struct */ 44 public GtkStyleProvider* getStyleProviderStruct() 45 { 46 return cast(GtkStyleProvider*)getStruct(); 47 } 48 49 /** 50 */ 51 52 /** 53 * Returns the #GtkIconFactory defined to be in use for @path, or %NULL if none 54 * is defined. 55 * 56 * Deprecated: Will always return %NULL for all GTK-provided style providers. 57 * 58 * Params: 59 * path = #GtkWidgetPath to query 60 * 61 * Return: The icon factory to use for @path, or %NULL 62 * 63 * Since: 3.0 64 */ 65 public IconFactory getIconFactory(WidgetPath path) 66 { 67 auto p = gtk_style_provider_get_icon_factory(getStyleProviderStruct(), (path is null) ? null : path.getWidgetPathStruct()); 68 69 if(p is null) 70 { 71 return null; 72 } 73 74 return ObjectG.getDObject!(IconFactory)(cast(GtkIconFactory*) p); 75 } 76 77 /** 78 * Returns the style settings affecting a widget defined by @path, or %NULL if 79 * @provider doesn’t contemplate styling @path. 80 * 81 * Deprecated: Will always return %NULL for all GTK-provided style providers 82 * as the interface cannot correctly work the way CSS is specified. 83 * 84 * Params: 85 * path = #GtkWidgetPath to query 86 * 87 * Return: a #GtkStyleProperties containing the 88 * style settings affecting @path 89 * 90 * Since: 3.0 91 */ 92 public StyleProperties getStyle(WidgetPath path) 93 { 94 auto p = gtk_style_provider_get_style(getStyleProviderStruct(), (path is null) ? null : path.getWidgetPathStruct()); 95 96 if(p is null) 97 { 98 return null; 99 } 100 101 return ObjectG.getDObject!(StyleProperties)(cast(GtkStyleProperties*) p, true); 102 } 103 104 /** 105 * Looks up a widget style property as defined by @provider for 106 * the widget represented by @path. 107 * 108 * Params: 109 * path = #GtkWidgetPath to query 110 * state = state to query the style property for 111 * pspec = The #GParamSpec to query 112 * value = return location for the property value 113 * 114 * Return: %TRUE if the property was found and has a value, %FALSE otherwise 115 * 116 * Since: 3.0 117 */ 118 public bool getStyleProperty(WidgetPath path, GtkStateFlags state, ParamSpec pspec, out Value value) 119 { 120 GValue* outvalue = new GValue; 121 122 auto p = gtk_style_provider_get_style_property(getStyleProviderStruct(), (path is null) ? null : path.getWidgetPathStruct(), state, (pspec is null) ? null : pspec.getParamSpecStruct(), outvalue) != 0; 123 124 value = ObjectG.getDObject!(Value)(outvalue); 125 126 return p; 127 } 128 }