]> Pileus Git - ~andy/gtk/blob - gtk/gtkcssinheritvalue.c
692ec5821f1e938ac7f001fd9a5a6f73811b0566
[~andy/gtk] / gtk / gtkcssinheritvalue.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 2011 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 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
18 #include "config.h"
19
20 #include "gtkcssinheritvalueprivate.h"
21
22 struct _GtkCssValue {
23   GTK_CSS_VALUE_BASE
24 };
25
26 static void
27 gtk_css_value_inherit_free (GtkCssValue *value)
28 {
29   /* Can only happen if the unique value gets unreffed too often */
30   g_assert_not_reached ();
31 }
32
33 static gboolean
34 gtk_css_value_inherit_equal (const GtkCssValue *value1,
35                              const GtkCssValue *value2)
36 {
37   return TRUE;
38 }
39
40 static GtkCssValue *
41 gtk_css_value_inherit_transition (GtkCssValue *start,
42                                   GtkCssValue *end,
43                                   double       progress)
44 {
45   return NULL;
46 }
47
48 static void
49 gtk_css_value_inherit_print (const GtkCssValue *value,
50                              GString           *string)
51 {
52   g_string_append (string, "inherit");
53 }
54
55 static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
56   gtk_css_value_inherit_free,
57   gtk_css_value_inherit_equal,
58   gtk_css_value_inherit_transition,
59   gtk_css_value_inherit_print
60 };
61
62 static GtkCssValue inherit = { &GTK_CSS_VALUE_INHERIT, 1 };
63
64 GtkCssValue *
65 _gtk_css_inherit_value_new (void)
66 {
67   return _gtk_css_value_ref (&inherit);
68 }
69
70 gboolean
71 _gtk_css_value_is_inherit (const GtkCssValue *value)
72 {
73   g_return_val_if_fail (value != NULL, FALSE);
74
75   return value == &inherit;
76 }