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