gtkcssvalueprivate.h 4.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
/*
 * Copyright © 2012 Red Hat Inc.
 *
 * 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.1 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, see <http://www.gnu.org/licenses/>.
 *
 * Authors: Alexander Larsson <alexl@gnome.org>
 */

#ifndef __GTK_CSS_VALUE_PRIVATE_H__
#define __GTK_CSS_VALUE_PRIVATE_H__

#include <glib-object.h>
#include "gtkcsstypesprivate.h"

G_BEGIN_DECLS

#define GTK_TYPE_CSS_VALUE           (_gtk_css_value_get_type ())

30 31
/* A GtkCssValue is a refcounted immutable value type */

32
typedef struct _GtkCssValue           GtkCssValue;
33
typedef struct _GtkCssValueClass      GtkCssValueClass;
34

35 36 37 38 39 40 41
/* using define instead of struct here so compilers get the packing right */
#define GTK_CSS_VALUE_BASE \
  const GtkCssValueClass *class; \
  volatile gint ref_count;

struct _GtkCssValueClass {
  void          (* free)                              (GtkCssValue                *value);
42

43
  GtkCssValue * (* compute)                           (GtkCssValue                *value,
44
                                                       guint                       property_id,
45
                                                       GtkStyleProviderPrivate    *provider,
46
                                                       GtkCssStyle                *style,
47
                                                       GtkCssStyle                *parent_style);
48 49
  gboolean      (* equal)                             (const GtkCssValue          *value1,
                                                       const GtkCssValue          *value2);
50 51
  GtkCssValue * (* transition)                        (GtkCssValue                *start,
                                                       GtkCssValue                *end,
52
                                                       guint                       property_id,
53
                                                       double                      progress);
54 55
  void          (* print)                             (const GtkCssValue          *value,
                                                       GString                    *string);
56
};
57 58

GType        _gtk_css_value_get_type                  (void) G_GNUC_CONST;
59 60 61 62 63

GtkCssValue *_gtk_css_value_alloc                     (const GtkCssValueClass     *klass,
                                                       gsize                       size);
#define _gtk_css_value_new(_name, _klass) ((_name *) _gtk_css_value_alloc ((_klass), sizeof (_name)))

64 65
GtkCssValue *_gtk_css_value_ref                       (GtkCssValue                *value);
void         _gtk_css_value_unref                     (GtkCssValue                *value);
66

67
GtkCssValue *_gtk_css_value_compute                   (GtkCssValue                *value,
68
                                                       guint                       property_id,
69
                                                       GtkStyleProviderPrivate    *provider,
70
                                                       GtkCssStyle                *style,
71
                                                       GtkCssStyle                *parent_style);
72 73
gboolean     _gtk_css_value_equal                     (const GtkCssValue          *value1,
                                                       const GtkCssValue          *value2);
74 75
gboolean     _gtk_css_value_equal0                    (const GtkCssValue          *value1,
                                                       const GtkCssValue          *value2);
76 77
GtkCssValue *_gtk_css_value_transition                (GtkCssValue                *start,
                                                       GtkCssValue                *end,
78
                                                       guint                       property_id,
79
                                                       double                      progress);
80

81
char *       _gtk_css_value_to_string                 (const GtkCssValue          *value);
82 83 84
void         _gtk_css_value_print                     (const GtkCssValue          *value,
                                                       GString                    *string);

85 86 87
G_END_DECLS

#endif /* __GTK_CSS_VALUE_PRIVATE_H__ */