]> Pileus Git - ~andy/gtk/blob - gtk/gtkstylepropertyprivate.h
styleproperty: Get rid of _gtk_style_property_is_shorthand()
[~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 #define GTK_TYPE_STYLE_PROPERTY           (_gtk_style_property_get_type ())
29 #define GTK_STYLE_PROPERTY(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_STYLE_PROPERTY, GtkStyleProperty))
30 #define GTK_STYLE_PROPERTY_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
31 #define GTK_IS_STYLE_PROPERTY(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
32 #define GTK_IS_STYLE_PROPERTY_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
33 #define GTK_STYLE_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
34
35 typedef struct _GtkStyleProperty           GtkStyleProperty;
36 typedef struct _GtkStylePropertyClass      GtkStylePropertyClass;
37
38 typedef enum {
39   GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
40 } GtkStylePropertyFlags;
41
42 typedef GParameter *     (* GtkStyleUnpackFunc)            (const GValue           *value,
43                                                             guint                  *n_params);
44 typedef void             (* GtkStylePackFunc)              (GValue                 *value,
45                                                             GtkStyleProperties     *props,
46                                                             GtkStateFlags           state,
47                                                             GtkStylePropertyContext *context);
48 typedef gboolean         (* GtkStyleParseFunc)             (GtkCssParser           *parser,
49                                                             GFile                  *base,
50                                                             GValue                 *value);
51 typedef void             (* GtkStylePrintFunc)             (const GValue           *value,
52                                                             GString                *string);
53 typedef void             (* GtkStyleUnsetFunc)             (GtkStyleProperties     *props,
54                                                             GtkStateFlags           state);
55
56 struct _GtkStyleProperty
57 {
58   GObject parent;
59
60   GParamSpec               *pspec;
61   GtkStylePropertyFlags     flags;
62   guint                     id;
63   GValue                    initial_value;
64
65   GtkStylePropertyParser    property_parse_func;
66   GtkStyleUnpackFunc        unpack_func;
67   GtkStylePackFunc          pack_func;
68   GtkStyleParseFunc         parse_func;
69   GtkStylePrintFunc         print_func;
70   GtkStyleUnsetFunc         unset_func;
71 };
72
73 struct _GtkStylePropertyClass
74 {
75   GObjectClass  parent_class;
76 };
77
78 GType               _gtk_style_property_get_type             (void) G_GNUC_CONST;
79
80 guint                    _gtk_style_property_get_count     (void);
81 const GtkStyleProperty * _gtk_style_property_get           (guint                   id);
82
83 const GtkStyleProperty * _gtk_style_property_lookup        (const char             *name);
84
85 void                     _gtk_style_property_register      (GParamSpec             *pspec,
86                                                             GtkStylePropertyFlags   flags,
87                                                             GtkStylePropertyParser  property_parse_func,
88                                                             GtkStyleUnpackFunc      unpack_func,
89                                                             GtkStylePackFunc        pack_func,
90                                                             GtkStyleParseFunc       parse_func,
91                                                             GtkStylePrintFunc       print_func,
92                                                             const GValue           *initial_value,
93                                                             GtkStyleUnsetFunc       unset_func);
94
95 gboolean                 _gtk_style_property_is_inherit    (const GtkStyleProperty *property);
96 guint                    _gtk_style_property_get_id        (const GtkStyleProperty *property);
97
98 const GValue *           _gtk_style_property_get_initial_value
99                                                            (const GtkStyleProperty *property);
100
101 GParameter *             _gtk_style_property_unpack        (const GtkStyleProperty *property,
102                                                             const GValue           *value,
103                                                             guint                  *n_params);
104
105 gboolean                 _gtk_style_property_parse_value   (const GtkStyleProperty *property,
106                                                             GValue                 *value,
107                                                             GtkCssParser           *parser,
108                                                             GFile                  *base);
109 void                     _gtk_style_property_print_value   (const GtkStyleProperty *property,
110                                                             const GValue           *value,
111                                                             GString                *string);
112
113 void                     _gtk_style_property_query         (const GtkStyleProperty *property,
114                                                             GtkStyleProperties     *props,
115                                                             GtkStateFlags           state,
116                                                             GtkStylePropertyContext *context,
117                                                             GValue                 *value);
118
119 G_END_DECLS
120
121 #endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */