]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylepropertyprivate.h
styleproperty: Pass initial value explicitly
[~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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __GTK_STYLEPROPERTY_PRIVATE_H__
21 #define __GTK_STYLEPROPERTY_PRIVATE_H__
22
23 #include "gtkcssparserprivate.h"
24 #include "gtkstylecontextprivate.h"
25
26 G_BEGIN_DECLS
27
28 typedef struct _GtkStyleProperty GtkStyleProperty;
29 typedef enum {
30   GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
31 } GtkStylePropertyFlags;
32
33 typedef GParameter *     (* GtkStyleUnpackFunc)            (const GValue           *value,
34                                                             guint                  *n_params);
35 typedef void             (* GtkStylePackFunc)              (GValue                 *value,
36                                                             GtkStyleProperties     *props,
37                                                             GtkStateFlags           state,
38                                                             GtkStylePropertyContext *context);
39 typedef gboolean         (* GtkStyleParseFunc)             (GtkCssParser           *parser,
40                                                             GFile                  *base,
41                                                             GValue                 *value);
42 typedef void             (* GtkStylePrintFunc)             (const GValue           *value,
43                                                             GString                *string);
44 typedef void             (* GtkStyleUnsetFunc)             (GtkStyleProperties     *props,
45                                                             GtkStateFlags           state);
46
47
48 struct _GtkStyleProperty
49 {
50   GParamSpec               *pspec;
51   GtkStylePropertyFlags     flags;
52   guint                     id;
53   GValue                    initial_value;
54
55   GtkStylePropertyParser    property_parse_func;
56   GtkStyleUnpackFunc        unpack_func;
57   GtkStylePackFunc          pack_func;
58   GtkStyleParseFunc         parse_func;
59   GtkStylePrintFunc         print_func;
60   GtkStyleUnsetFunc         unset_func;
61 };
62
63 guint                    _gtk_style_property_get_count     (void);
64 const GtkStyleProperty * _gtk_style_property_get           (guint                   id);
65
66 const GtkStyleProperty * _gtk_style_property_lookup        (const char             *name);
67
68 void                     _gtk_style_property_register      (GParamSpec             *pspec,
69                                                             GtkStylePropertyFlags   flags,
70                                                             GtkStylePropertyParser  property_parse_func,
71                                                             GtkStyleUnpackFunc      unpack_func,
72                                                             GtkStylePackFunc        pack_func,
73                                                             GtkStyleParseFunc       parse_func,
74                                                             GtkStylePrintFunc       print_func,
75                                                             const GValue           *initial_value,
76                                                             GtkStyleUnsetFunc       unset_func);
77
78 gboolean                 _gtk_style_property_is_inherit    (const GtkStyleProperty *property);
79 guint                    _gtk_style_property_get_id        (const GtkStyleProperty *property);
80
81 void                     _gtk_style_property_default_value (const GtkStyleProperty *property,
82                                                             GtkStyleProperties     *properties,
83                                                             GtkStateFlags           state,
84                                                             GValue                 *value);
85
86 void                     _gtk_style_property_resolve       (const GtkStyleProperty *property,
87                                                             GtkStyleProperties     *properties,
88                                                             GtkStateFlags           state,
89                                                             GtkStylePropertyContext *context,
90                                                             GValue                 *orig_value,
91                                                             GValue                 *out_value);
92
93 gboolean                 _gtk_style_property_is_shorthand  (const GtkStyleProperty *property);
94 GParameter *             _gtk_style_property_unpack        (const GtkStyleProperty *property,
95                                                             const GValue           *value,
96                                                             guint                  *n_params);
97 void                     _gtk_style_property_pack          (const GtkStyleProperty *property,
98                                                             GtkStyleProperties     *props,
99                                                             GtkStateFlags           state,
100                                                             GtkStylePropertyContext *context,
101                                                             GValue                 *value);
102
103 gboolean                 _gtk_style_property_parse_value   (const GtkStyleProperty *property,
104                                                             GValue                 *value,
105                                                             GtkCssParser           *parser,
106                                                             GFile                  *base);
107 void                     _gtk_style_property_print_value   (const GtkStyleProperty *property,
108                                                             const GValue           *value,
109                                                             GString                *string);
110
111 G_END_DECLS
112
113 #endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */