1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2011 Red Hat, Inc.
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.
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.
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/>.
20 #include "gtkcsstypedvalueprivate.h"
22 #include "gtkcssstylefuncsprivate.h"
30 gtk_css_value_typed_free (GtkCssValue *value)
32 g_value_unset (&value->value);
33 g_slice_free (GtkCssValue, value);
37 gtk_css_value_typed_equal (const GtkCssValue *value1,
38 const GtkCssValue *value2)
44 gtk_css_value_typed_transition (GtkCssValue *start,
52 gtk_css_value_typed_print (const GtkCssValue *value,
55 _gtk_css_style_print_value (&value->value, string);
58 static const GtkCssValueClass GTK_CSS_VALUE_TYPED = {
59 gtk_css_value_typed_free,
60 gtk_css_value_typed_equal,
61 gtk_css_value_typed_transition,
62 gtk_css_value_typed_print
66 gtk_css_typed_value_new_for_type (GType type)
70 result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_TYPED);
72 g_value_init (&result->value, type);
78 _gtk_css_typed_value_new (const GValue *value)
82 g_return_val_if_fail (G_IS_VALUE (value), NULL);
84 result = gtk_css_typed_value_new_for_type (G_VALUE_TYPE (value));
86 g_value_copy (value, &result->value);
92 _gtk_css_typed_value_new_take (GValue *value)
96 g_return_val_if_fail (G_IS_VALUE (value), NULL);
98 result = _gtk_css_typed_value_new (value);
99 g_value_unset (value);
105 _gtk_is_css_typed_value_of_type (const GtkCssValue *value,
108 if (value->class != >K_CSS_VALUE_TYPED)
111 return G_VALUE_HOLDS (&value->value, type);
115 _gtk_css_typed_value_get (const GtkCssValue *value)
117 g_return_val_if_fail (value->class == >K_CSS_VALUE_TYPED, NULL);
119 return &value->value;