1/*
2 * Copyright © 2012 Red Hat Inc.
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.1 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 * Authors: Alexander Larsson <alexl@gnome.org>
18 */
19
20#ifndef __GTK_CSS_VALUE_PRIVATE_H__
21#define __GTK_CSS_VALUE_PRIVATE_H__
22
23#include <glib-object.h>
24
25#include "gtkcsstypesprivate.h"
26#include "gtkstyleprovider.h"
27
28G_BEGIN_DECLS
29
30#define GTK_TYPE_CSS_VALUE (_gtk_css_value_get_type ())
31
32/* A GtkCssValue is a refcounted immutable value type */
33
34typedef struct _GtkCssValue GtkCssValue;
35typedef struct _GtkCssValueClass GtkCssValueClass;
36
37/* using define instead of struct here so compilers get the packing right */
38#define GTK_CSS_VALUE_BASE \
39 const GtkCssValueClass *class; \
40 int ref_count; \
41 guint is_computed: 1;
42
43struct _GtkCssValueClass {
44 const char *type_name;
45 void (* free) (GtkCssValue *value);
46
47 GtkCssValue * (* compute) (GtkCssValue *value,
48 guint property_id,
49 GtkStyleProvider *provider,
50 GtkCssStyle *style,
51 GtkCssStyle *parent_style);
52 gboolean (* equal) (const GtkCssValue *value1,
53 const GtkCssValue *value2);
54 GtkCssValue * (* transition) (GtkCssValue *start,
55 GtkCssValue *end,
56 guint property_id,
57 double progress);
58 gboolean (* is_dynamic) (const GtkCssValue *value);
59 GtkCssValue * (* get_dynamic_value) (GtkCssValue *value,
60 gint64 monotonic_time);
61 void (* print) (const GtkCssValue *value,
62 GString *string);
63};
64
65GType _gtk_css_value_get_type (void) G_GNUC_CONST;
66
67GtkCssValue *_gtk_css_value_alloc (const GtkCssValueClass *klass,
68 gsize size);
69#define _gtk_css_value_new(_name, _klass) ((_name *) _gtk_css_value_alloc ((_klass), sizeof (_name)))
70
71#define _gtk_css_value_ref gtk_css_value_ref
72GtkCssValue * gtk_css_value_ref (GtkCssValue *value);
73#define _gtk_css_value_unref gtk_css_value_unref
74void gtk_css_value_unref (GtkCssValue *value);
75
76GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
77 guint property_id,
78 GtkStyleProvider *provider,
79 GtkCssStyle *style,
80 GtkCssStyle *parent_style) G_GNUC_PURE;
81gboolean _gtk_css_value_equal (const GtkCssValue *value1,
82 const GtkCssValue *value2) G_GNUC_PURE;
83gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
84 const GtkCssValue *value2) G_GNUC_PURE;
85GtkCssValue *_gtk_css_value_transition (GtkCssValue *start,
86 GtkCssValue *end,
87 guint property_id,
88 double progress);
89gboolean gtk_css_value_is_dynamic (const GtkCssValue *value) G_GNUC_PURE;
90GtkCssValue * gtk_css_value_get_dynamic_value (GtkCssValue *value,
91 gint64 monotonic_time);
92
93char * _gtk_css_value_to_string (const GtkCssValue *value);
94void _gtk_css_value_print (const GtkCssValue *value,
95 GString *string);
96gboolean gtk_css_value_is_computed (const GtkCssValue *value) G_GNUC_PURE;
97
98G_END_DECLS
99
100#endif /* __GTK_CSS_VALUE_PRIVATE_H__ */
101

source code of gtk/gtk/gtkcssvalueprivate.h