]> Pileus Git - ~andy/gtk/blob - gtk/gtkstyleproviderprivate.c
fc7e29862e25278eb9c709fbff9edfd8746c66d0
[~andy/gtk] / gtk / gtkstyleproviderprivate.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 #include "config.h"
19
20 #include "gtkstyleproviderprivate.h"
21 #include "gtkstyleprovider.h"
22
23 G_DEFINE_INTERFACE (GtkStyleProviderPrivate, _gtk_style_provider_private, GTK_TYPE_STYLE_PROVIDER)
24
25 static void
26 _gtk_style_provider_private_default_init (GtkStyleProviderPrivateInterface *iface)
27 {
28 }
29
30 GtkSymbolicColor *
31 _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
32                                        const char              *name)
33 {
34   GtkStyleProviderPrivateInterface *iface;
35
36   g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
37
38   iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
39
40   if (!iface->get_color)
41     return NULL;
42
43   return iface->get_color (provider, name);
44 }
45
46 void
47 _gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
48                                     const GtkCssMatcher     *matcher,
49                                     GtkCssLookup            *lookup)
50 {
51   GtkStyleProviderPrivateInterface *iface;
52
53   g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
54   g_return_if_fail (matcher != NULL);
55   g_return_if_fail (lookup != NULL);
56
57   iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
58
59   if (!iface->lookup)
60     return;
61
62   iface->lookup (provider, matcher, lookup);
63 }
64
65 GtkCssChange
66 _gtk_style_provider_private_get_change (GtkStyleProviderPrivate *provider,
67                                         const GtkCssMatcher     *matcher)
68 {
69   GtkStyleProviderPrivateInterface *iface;
70
71   g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), GTK_CSS_CHANGE_ANY);
72   g_return_val_if_fail (matcher != NULL, GTK_CSS_CHANGE_ANY);
73
74   iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
75
76   if (!iface->get_change)
77     return GTK_CSS_CHANGE_ANY;
78
79   return iface->get_change (provider, matcher);
80 }