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