]> Pileus Git - ~andy/gtk/blob - gtk/gtkstyleprovider.c
Add GtkStyleProvider, an interface to provide style details.
[~andy/gtk] / gtk / gtkstyleprovider.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2010 Carlos Garnacho <carlosg@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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #include "config.h"
21
22 #include "gtkprivate.h"
23 #include "gtkstyleprovider.h"
24 #include "gtkintl.h"
25
26 #include "gtkalias.h"
27
28 static void gtk_style_provider_iface_init (gpointer g_iface);
29
30 GType
31 gtk_style_provider_get_type (void)
32 {
33   static GType style_provider_type = 0;
34
35   if (!style_provider_type)
36     style_provider_type = g_type_register_static_simple (G_TYPE_INTERFACE,
37                                                          I_("GtkStyleProvider"),
38                                                          sizeof (GtkStyleProviderIface),
39                                                          (GClassInitFunc) gtk_style_provider_iface_init,
40                                                          0, NULL, 0);
41   return style_provider_type;
42 }
43
44 static void
45 gtk_style_provider_iface_init (gpointer g_iface)
46 {
47   GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
48 }
49
50 GtkStyleSet *
51 gtk_style_provider_get_style (GtkStyleProvider *provider)
52 {
53   GtkStyleProviderIface *iface;
54
55   g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
56
57   iface = GTK_STYLE_PROVIDER_GET_IFACE (provider);
58
59   if (!iface->get_style)
60     return NULL;
61
62   return iface->get_style (provider);
63 }
64
65 #define __GTK_STYLE_PROVIDER_C__
66 #include "gtkaliasdef.c"