1 /* Fo
2 * fo-property-border-left.c: 'border-left' property
3 *
4 * Copyright (C) 2001-2005 Sun Microsystems
5 * Copyright (C) 2007 Menteith Consulting Ltd
6 *
7 * See COPYING for the status of this software.
8 */
9
10 #include <string.h>
11 #include "fo-utils.h"
12 #include "fo-context.h"
13 #include "datatype/fo-datatype.h"
14 #include "property/fo-property-private.h"
15 #include "property/fo-property-font-size.h"
16 #include "property/fo-property-border-left.h"
17 #include "property/fo-property-util.h"
18
19 /* border-left */
20 /* Inherited: FALSE */
21 /* Shorthand: TRUE */
22 /* [ <border-width> || <border-style> || <color> ] | inherit */
23 /* Initial value: see individual properties */
24
25 struct _FoPropertyBorderLeft
26 {
27 FoProperty parent_instance;
28 };
29
30 struct _FoPropertyBorderLeftClass
31 {
32 FoPropertyClass parent_class;
33 };
34
35 static void fo_property_border_left_init (FoPropertyBorderLeft *property_border_left);
36 static void fo_property_border_left_class_init (FoPropertyBorderLeftClass *klass);
37 static void fo_property_border_left_finalize (GObject *object);
38
39
40 static const gchar class_name[] = "border-left";
41 static gpointer parent_class;
42
43 /**
44 * fo_property_border_left_get_type:
45 *
46 * Register the #FoPropertyBorderLeft type if not already registered and
47 * return its #GType value.
48 *
49 * Return value: #GType of #FoPropertyBorderLeft.
50 **/
51 GType
fo_property_border_left_get_type(void)52 fo_property_border_left_get_type (void)
53 {
54 static GType object_type = 0;
55
56 if (!object_type)
57 {
58 static const GTypeInfo object_info =
59 {
60 sizeof (FoPropertyBorderLeftClass),
61 NULL, /* base_init */
62 NULL, /* base_finalize */
63 (GClassInitFunc) fo_property_border_left_class_init,
64 NULL, /* class_finalize */
65 NULL, /* class_data */
66 sizeof (FoPropertyBorderLeft),
67 0, /* n_preallocs */
68 (GInstanceInitFunc) fo_property_border_left_init,
69 NULL /* value_table */
70 };
71
72 object_type = g_type_register_static (FO_TYPE_PROPERTY,
73 class_name,
74 &object_info, 0);
75 }
76
77 return object_type;
78 }
79
80 /**
81 * fo_property_border_left_init:
82 * @border_left: #FoPropertyBorderLeft object to initialise.
83 *
84 * Implements #GInstanceInitFunc for #FoPropertyBorderLeft.
85 **/
86 void
fo_property_border_left_init(FoPropertyBorderLeft * border_left)87 fo_property_border_left_init (FoPropertyBorderLeft *border_left)
88 {
89 FO_PROPERTY (border_left)->value =
90 NULL;
91 }
92
93 /**
94 * fo_property_border_left_class_init:
95 * @klass: #FoPropertyBorderLeftClass object to initialise.
96 *
97 * Implements #GClassInitFunc for #FoPropertyBorderLeftClass.
98 **/
99 void
fo_property_border_left_class_init(FoPropertyBorderLeftClass * klass)100 fo_property_border_left_class_init (FoPropertyBorderLeftClass *klass)
101 {
102 GObjectClass *object_class = G_OBJECT_CLASS (klass);
103 FoPropertyClass *property_class = FO_PROPERTY_CLASS (klass);
104
105 parent_class = g_type_class_peek_parent (klass);
106
107 object_class->finalize = fo_property_border_left_finalize;
108
109 property_class->expr_eval = fo_expr_wsc_eval;
110 property_class->is_inherited = FALSE;
111 property_class->is_shorthand = TRUE;
112 property_class->resolve_enum =
113 fo_property_util_resolve_wsc_enum;
114 property_class->validate =
115 fo_property_util_validate_wsc;
116 property_class->get_initial =
117 fo_property_border_left_get_initial;
118 }
119
120 /**
121 * fo_property_border_left_finalize:
122 * @object: #FoPropertyBorderLeft object to finalize.
123 *
124 * Implements #GObjectFinalizeFunc for #FoPropertyBorderLeft.
125 **/
126 void
fo_property_border_left_finalize(GObject * object)127 fo_property_border_left_finalize (GObject *object)
128 {
129 FoPropertyBorderLeft *border_left;
130
131 border_left = FO_PROPERTY_BORDER_LEFT (object);
132
133 G_OBJECT_CLASS (parent_class)->finalize (object);
134 }
135
136
137 /**
138 * fo_property_border_left_new:
139 *
140 * Creates a new #FoPropertyBorderLeft initialized to default value.
141 *
142 * Return value: the new #FoPropertyBorderLeft.
143 **/
144 FoProperty*
fo_property_border_left_new(void)145 fo_property_border_left_new (void)
146 {
147 FoProperty* border_left;
148
149 border_left =
150 FO_PROPERTY (g_object_new (fo_property_border_left_get_type (),
151 NULL));
152
153 return border_left;
154 }
155
156 /**
157 * fo_property_border_left_get_initial:
158 *
159 * Get an instance of the property with the correct initial value.
160 *
161 * Return value: An instance of the property.
162 **/
163 FoProperty*
fo_property_border_left_get_initial(void)164 fo_property_border_left_get_initial (void)
165 {
166 static FoProperty *border_left = NULL;
167
168 if (border_left == NULL)
169 {
170 border_left =
171 fo_property_border_left_new ();
172 }
173
174 return border_left;
175 }
176