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