]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylepropertyprivate.h
d1691391a3c59bbe4394205117302c18972338fc
[~andy/gtk] / gtk / gtkstylepropertyprivate.h
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, see <http://www.gnu.org/licenses/>.
16  */
17
18 #ifndef __GTK_STYLEPROPERTY_PRIVATE_H__
19 #define __GTK_STYLEPROPERTY_PRIVATE_H__
20
21 #include "gtkcssparserprivate.h"
22 #include "gtkstylecontextprivate.h"
23 #include "gtkcssvalueprivate.h"
24
25 G_BEGIN_DECLS
26
27 #define GTK_TYPE_STYLE_PROPERTY           (_gtk_style_property_get_type ())
28 #define GTK_STYLE_PROPERTY(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_STYLE_PROPERTY, GtkStyleProperty))
29 #define GTK_STYLE_PROPERTY_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
30 #define GTK_IS_STYLE_PROPERTY(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
31 #define GTK_IS_STYLE_PROPERTY_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
32 #define GTK_STYLE_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
33
34 typedef struct _GtkStyleProperty           GtkStyleProperty;
35 typedef struct _GtkStylePropertyClass      GtkStylePropertyClass;
36
37 typedef enum {
38   GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
39 } GtkStylePropertyFlags;
40
41 typedef GtkCssValue *   (* GtkStyleQueryFunc)        (guint                   id,
42                                                       gpointer                data);
43
44 struct _GtkStyleProperty
45 {
46   GObject parent;
47
48   char *name;
49   GType value_type;
50 };
51
52 struct _GtkStylePropertyClass
53 {
54   GObjectClass  parent_class;
55   
56   void              (* assign)                             (GtkStyleProperty       *property,
57                                                             GtkStyleProperties     *props,
58                                                             GtkStateFlags           state,
59                                                             const GValue           *value);
60   void              (* query)                              (GtkStyleProperty       *property,
61                                                             GValue                 *value,
62                                                             GtkStyleQueryFunc       query_func,
63                                                             gpointer                query_data);
64   gboolean          (* parse_value)                        (GtkStyleProperty *      property,
65                                                             GValue                 *value,
66                                                             GtkCssParser           *parser,
67                                                             GFile                  *base);
68
69   GHashTable   *properties;
70 };
71
72 GType               _gtk_style_property_get_type             (void) G_GNUC_CONST;
73
74 void                _gtk_style_property_init_properties      (void);
75
76 GtkStyleProperty *       _gtk_style_property_lookup        (const char             *name);
77
78 const char *             _gtk_style_property_get_name      (GtkStyleProperty       *property);
79
80 gboolean                 _gtk_style_property_parse_value   (GtkStyleProperty *      property,
81                                                             GValue                 *value,
82                                                             GtkCssParser           *parser,
83                                                             GFile                  *base);
84
85 GType                    _gtk_style_property_get_value_type(GtkStyleProperty *      property);
86 void                     _gtk_style_property_query         (GtkStyleProperty *      property,
87                                                             GValue                 *value,
88                                                             GtkStyleQueryFunc       query_func,
89                                                             gpointer                query_data);
90 void                     _gtk_style_property_assign        (GtkStyleProperty       *property,
91                                                             GtkStyleProperties     *props,
92                                                             GtkStateFlags           state,
93                                                             const GValue           *value);
94
95 G_END_DECLS
96
97 #endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */