gtkstylepropertyprivate.h 6.17 KB
Newer Older
Benjamin Otte's avatar
Benjamin Otte committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/* GTK - The GIMP Toolkit
 * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

20 21
#ifndef __GTK_STYLEPROPERTY_PRIVATE_H__
#define __GTK_STYLEPROPERTY_PRIVATE_H__
Benjamin Otte's avatar
Benjamin Otte committed
22

23
#include "gtkcssparserprivate.h"
24
#include "gtkstylecontextprivate.h"
Benjamin Otte's avatar
Benjamin Otte committed
25 26 27

G_BEGIN_DECLS

28 29 30 31 32 33 34 35 36 37
#define GTK_TYPE_STYLE_PROPERTY           (_gtk_style_property_get_type ())
#define GTK_STYLE_PROPERTY(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GTK_TYPE_STYLE_PROPERTY, GtkStyleProperty))
#define GTK_STYLE_PROPERTY_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))
#define GTK_IS_STYLE_PROPERTY(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
#define GTK_IS_STYLE_PROPERTY_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_STYLE_PROPERTY))
#define GTK_STYLE_PROPERTY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE_PROPERTY, GtkStylePropertyClass))

typedef struct _GtkStyleProperty           GtkStyleProperty;
typedef struct _GtkStylePropertyClass      GtkStylePropertyClass;

Benjamin Otte's avatar
Benjamin Otte committed
38 39 40
typedef enum {
  GTK_STYLE_PROPERTY_INHERIT = (1 << 0)
} GtkStylePropertyFlags;
41

42 43 44 45
typedef GParameter *     (* GtkStyleUnpackFunc)            (const GValue           *value,
                                                            guint                  *n_params);
typedef void             (* GtkStylePackFunc)              (GValue                 *value,
                                                            GtkStyleProperties     *props,
46 47
                                                            GtkStateFlags           state,
							    GtkStylePropertyContext *context);
48 49 50 51 52
typedef gboolean         (* GtkStyleParseFunc)             (GtkCssParser           *parser,
                                                            GFile                  *base,
                                                            GValue                 *value);
typedef void             (* GtkStylePrintFunc)             (const GValue           *value,
                                                            GString                *string);
53 54
typedef void             (* GtkStyleUnsetFunc)             (GtkStyleProperties     *props,
                                                            GtkStateFlags           state);
55

56 57
struct _GtkStyleProperty
{
58 59
  GObject parent;

60 61
  char *name;

62
  GParamSpec               *pspec;
Benjamin Otte's avatar
Benjamin Otte committed
63
  GtkStylePropertyFlags     flags;
64
  guint                     id;
65
  GValue                    initial_value;
Benjamin Otte's avatar
Benjamin Otte committed
66

67 68 69 70 71
  GtkStylePropertyParser    property_parse_func;
  GtkStyleUnpackFunc        unpack_func;
  GtkStylePackFunc          pack_func;
  GtkStyleParseFunc         parse_func;
  GtkStylePrintFunc         print_func;
72
  GtkStyleUnsetFunc         unset_func;
73 74
};

75 76 77
struct _GtkStylePropertyClass
{
  GObjectClass  parent_class;
78 79
  
  GHashTable   *properties;
80 81 82 83
};

GType               _gtk_style_property_get_type             (void) G_GNUC_CONST;

84
guint                    _gtk_style_property_get_count     (void);
Benjamin Otte's avatar
Benjamin Otte committed
85
GtkStyleProperty *       _gtk_style_property_get           (guint                   id);
86

Benjamin Otte's avatar
Benjamin Otte committed
87
GtkStyleProperty *       _gtk_style_property_lookup        (const char             *name);
88

89 90
const char *             _gtk_style_property_get_name      (GtkStyleProperty       *property);

91
void                     _gtk_style_property_register      (GParamSpec             *pspec,
Benjamin Otte's avatar
Benjamin Otte committed
92
                                                            GtkStylePropertyFlags   flags,
Benjamin Otte's avatar
Benjamin Otte committed
93
                                                            GtkStylePropertyParser  property_parse_func,
94
                                                            GtkStyleParseFunc       parse_func,
95
                                                            GtkStylePrintFunc       print_func,
96
                                                            const GValue           *initial_value);
97

Benjamin Otte's avatar
Benjamin Otte committed
98 99
gboolean                 _gtk_style_property_is_inherit    (GtkStyleProperty *      property);
guint                    _gtk_style_property_get_id        (GtkStyleProperty *      property);
100

101
const GValue *           _gtk_style_property_get_initial_value
Benjamin Otte's avatar
Benjamin Otte committed
102
                                                           (GtkStyleProperty *      property);
103

Benjamin Otte's avatar
Benjamin Otte committed
104
GParameter *             _gtk_style_property_unpack        (GtkStyleProperty *      property,
105 106
                                                            const GValue           *value,
                                                            guint                  *n_params);
107

Benjamin Otte's avatar
Benjamin Otte committed
108
gboolean                 _gtk_style_property_parse_value   (GtkStyleProperty *      property,
109 110 111
                                                            GValue                 *value,
                                                            GtkCssParser           *parser,
                                                            GFile                  *base);
Benjamin Otte's avatar
Benjamin Otte committed
112
void                     _gtk_style_property_print_value   (GtkStyleProperty *      property,
113 114
                                                            const GValue           *value,
                                                            GString                *string);
Benjamin Otte's avatar
Benjamin Otte committed
115

Benjamin Otte's avatar
Benjamin Otte committed
116
void                     _gtk_style_property_query         (GtkStyleProperty *      property,
117 118 119 120 121
                                                            GtkStyleProperties     *props,
                                                            GtkStateFlags           state,
							    GtkStylePropertyContext *context,
                                                            GValue                 *value);

Benjamin Otte's avatar
Benjamin Otte committed
122 123
G_END_DECLS

124
#endif /* __GTK_CSS_STYLEPROPERTY_PRIVATE_H__ */