1 /* Fo
2 * fo-property-border-start-style.c: 'border-start-style' property
3 *
4 * Copyright (C) 2001 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-start-style.h"
17 #include "property/fo-property-util.h"
18
19 /* border-start-style */
20 /* Inherited: FALSE */
21 /* Shorthand: FALSE */
22 /* <border-style> | inherit */
23 /* Initial value: none */
24
25 struct _FoPropertyBorderStartStyle
26 {
27 FoProperty parent_instance;
28 };
29
30 struct _FoPropertyBorderStartStyleClass
31 {
32 FoPropertyClass parent_class;
33 };
34
35 static void fo_property_border_start_style_init (FoPropertyBorderStartStyle *property_border_start_style);
36 static void fo_property_border_start_style_class_init (FoPropertyBorderStartStyleClass *klass);
37 static void fo_property_border_start_style_finalize (GObject *object);
38
39 static const gchar class_name[] = "border-start-style";
40 static gpointer parent_class;
41
42 /**
43 * fo_property_border_start_style_get_type:
44 *
45 * Register the #FoPropertyBorderStartStyle type if not already registered and
46 * return its #GType value.
47 *
48 * Return value: #GType of #FoPropertyBorderStartStyle.
49 **/
50 GType
fo_property_border_start_style_get_type(void)51 fo_property_border_start_style_get_type (void)
52 {
53 static GType object_type = 0;
54
55 if (!object_type)
56 {
57 static const GTypeInfo object_info =
58 {
59 sizeof (FoPropertyBorderStartStyleClass),
60 NULL, /* base_init */
61 NULL, /* base_finalize */
62 (GClassInitFunc) fo_property_border_start_style_class_init,
63 NULL, /* class_finalize */
64 NULL, /* class_data */
65 sizeof (FoPropertyBorderStartStyle),
66 0, /* n_preallocs */
67 (GInstanceInitFunc) fo_property_border_start_style_init,
68 NULL /* value_table */
69 };
70
71 object_type = g_type_register_static (FO_TYPE_PROPERTY,
72 class_name,
73 &object_info, 0);
74 }
75
76 return object_type;
77 }
78
79 /**
80 * fo_property_border_start_style_init:
81 * @border_start_style: #FoPropertyBorderStartStyle object to initialise.
82 *
83 * Implements #GInstanceInitFunc for #FoPropertyBorderStartStyle.
84 **/
85 void
fo_property_border_start_style_init(FoPropertyBorderStartStyle * border_start_style)86 fo_property_border_start_style_init (FoPropertyBorderStartStyle *border_start_style)
87 {
88 FO_PROPERTY (border_start_style)->value =
89 g_object_ref (fo_property_util_get_style_initial ());
90 }
91
92 /**
93 * fo_property_border_start_style_class_init:
94 * @klass: #FoPropertyBorderStartStyleClass object to initialise.
95 *
96 * Implements #GClassInitFunc for #FoPropertyBorderStartStyleClass.
97 **/
98 void
fo_property_border_start_style_class_init(FoPropertyBorderStartStyleClass * klass)99 fo_property_border_start_style_class_init (FoPropertyBorderStartStyleClass *klass)
100 {
101 GObjectClass *object_class = G_OBJECT_CLASS (klass);
102 FoPropertyClass *property_class = FO_PROPERTY_CLASS (klass);
103
104 parent_class = g_type_class_peek_parent (klass);
105
106 object_class->finalize = fo_property_border_start_style_finalize;
107
108 property_class->is_inherited = FALSE;
109 property_class->is_shorthand = FALSE;
110 property_class->resolve_enum =
111 fo_property_util_resolve_style_enum;
112 property_class->validate =
113 fo_property_util_validate_style;
114 property_class->get_initial =
115 fo_property_border_start_style_get_initial;
116 }
117
118 /**
119 * fo_property_border_start_style_finalize:
120 * @object: #FoPropertyBorderStartStyle object to finalize.
121 *
122 * Implements #GObjectFinalizeFunc for #FoPropertyBorderStartStyle.
123 **/
124 void
fo_property_border_start_style_finalize(GObject * object)125 fo_property_border_start_style_finalize (GObject *object)
126 {
127 FoPropertyBorderStartStyle *border_start_style;
128
129 border_start_style = FO_PROPERTY_BORDER_START_STYLE (object);
130
131 G_OBJECT_CLASS (parent_class)->finalize (object);
132 }
133
134
135 /**
136 * fo_property_border_start_style_new:
137 *
138 * Creates a new #FoPropertyBorderStartStyle initialized to default value.
139 *
140 * Return value: the new #FoPropertyBorderStartStyle.
141 **/
142 FoProperty*
fo_property_border_start_style_new(void)143 fo_property_border_start_style_new (void)
144 {
145 FoProperty* border_start_style;
146
147 border_start_style =
148 FO_PROPERTY (g_object_new (fo_property_border_start_style_get_type (),
149 NULL));
150
151 return border_start_style;
152 }
153
154 /**
155 * fo_property_border_start_style_get_initial:
156 *
157 * Get an instance of the property with the correct initial value.
158 *
159 * Return value: An instance of the property.
160 **/
161 FoProperty*
fo_property_border_start_style_get_initial(void)162 fo_property_border_start_style_get_initial (void)
163 {
164 static FoProperty *border_start_style = NULL;
165
166 if (border_start_style == NULL)
167 {
168 border_start_style =
169 fo_property_border_start_style_new ();
170 }
171
172 return border_start_style;
173 }
174