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