Libcroco
cr-style.h
Go to the documentation of this file.
1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
2 
3 /*
4  * This file is part of The Croco Library
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2.1 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Author: Dodji Seketeli.
22  * See COPYRIGHTS file for copyright information.
23  */
24 
25 #ifndef __CR_STYLE_H__
26 #define __CR_STYLE_H__
27 
28 #include "cr-utils.h"
29 #include "cr-statement.h"
30 #include "cr-fonts.h"
31 
32 /**
33  *@file
34  *The declaration of the #CRStyle class.
35  */
36 G_BEGIN_DECLS
37 
38 typedef struct _CRStyle CRStyle ;
39 
41 {
53 } ;
54 
56 {
75 } ;
76 
78 {
84 } ;
85 
87 {
92 } ;
93 
95 {
100 } ;
101 
102 
103 #define BORDER_THIN 2
104 #define BORDER_MEDIUM 4
105 #define BORDER_THICK 6
106 
107 
108 /**
109  *A numerical css property value.
110  *This data type is actually split in 3 parts:
111  *1/the specified value
112  *2/the computed value
113  *3/the actual value.
114  *To understand the semantic of these three parts,
115  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
116  */
117 typedef struct _CRNumPropVal CRNumPropVal ;
119 {
120  /**specified value*/
122  /**computed value*/
124  /**actual value*/
126 } ;
127 
128 /**
129  *An rgb css property value.
130  *This data type is actually split in 3 parts:
131  *1/the specified value
132  *2/the computed value
133  *3/the actual value.
134  *To understand the semantic of these three parts,
135  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
136  */
137 typedef struct _CRRgbPropVal CRRgbPropVal ;
139 {
140  /**specified value*/
142  /**computed value*/
144  /**actual value*/
146 } ;
147 
148 
150 {
155 
160 
165 
170 
172 
173  /*must be last*/
175 } ;
176 
178 {
185 
186  /*must be last*/
188 } ;
189 
190 
192 {
197 
198  /*must be last*/
200 } ;
201 
203 {
208 
209  /*must be last*/
211 } ;
212 
215  /*specified value*/
217  /*computed value*/
219  /*actual value*/
221 } ;
222 
223 /**
224  *The css2 style class.
225  *Contains computed and actual values
226  *inferred from the declarations found
227  *in the stylesheets.
228  *See css2 spec chapter 6.
229  */
230 struct _CRStyle
231 {
232  /**
233  *numerical properties.
234  *the properties are indexed by
235  *enum #CRNumProp.
236  */
238 
239  /**
240  *color properties.
241  *They are indexed by enum #CRRgbProp .
242  */
244 
245  /**
246  *border style properties.
247  *They are indexed by enum #CRBorderStyleProp .
248  */
250 
251  /**box display type*/
253 
254  /**the positioning scheme*/
256 
257  /**the float property*/
259 
260  /*
261  *the 'font-family' property.
262  */
264 
265  /**
266  *the 'font-size' property.
267  */
274 
275  /**
276  * the 'tex' properties
277  */
279 
282  gulong ref_count ;
283 } ;
284 
286  GString * a_str, guint a_nb_indent) ;
287 
289  GString *a_str,
290  guint a_nb_indent) ;
291 
293  GString *a_str,
294  guint a_nb_indent) ;
295 
297  GString *a_str,
298  guint a_nb_indent) ;
299 
301  GString *a_str,
302  guint a_nb_indent) ;
303 
305  GString *a_str,
306  guint a_nb_indent) ;
307 
309  GString *a_str,
310  guint a_nb_indent) ;
311 
312 CRStyle * cr_style_new (gboolean a_set_props_to_initial_values) ;
313 
318 
320  CRDeclaration *a_decl) ;
321 
322 
323 enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src) ;
324 
325 enum CRStatus cr_style_ref (CRStyle *a_this) ;
326 
327 gboolean cr_style_unref (CRStyle *a_this) ;
328 
329 void cr_style_destroy (CRStyle *a_this) ;
330 
331 CRStyle * cr_style_dup (CRStyle *a_this) ;
332 
333 enum CRStatus cr_style_to_string (CRStyle *a_this,
334  GString **a_str,
335  guint a_nb_indent) ;
336 
337 G_END_DECLS
338 
339 #endif /*__CR_STYLE_H__*/
enum CRFloatType float_type
the float property
Definition: cr-style.h:258
CRRgbProp
Definition: cr-style.h:177
enum CRStatus cr_style_set_props_to_initial_values(CRStyle *a_this)
Sets the style properties to their initial value according to the css2 spec.
Definition: cr-style.c:1845
enum CRStatus cr_style_border_style_to_string(enum CRBorderStyle a_prop, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2436
CRFontSizeAdjust * font_size_adjust
Definition: cr-style.h:269
typedefG_BEGIN_DECLS struct _CRRgb CRRgb
Definition: cr-rgb.h:34
Declaration of the CRStatement class.
enum CRStatus cr_style_set_props_to_default_values(CRStyle *a_this)
Sets the style properties to their default values according to the css2 spec i.e inherit if the prope...
Definition: cr-style.c:1740
gboolean cr_style_unref(CRStyle *a_this)
Decreases the reference count of the current instance of CRStyle.
Definition: cr-style.c:2264
CRRgb sv
specified value
Definition: cr-style.h:141
CRPositionType
Definition: cr-style.h:77
CRRgb av
actual value
Definition: cr-style.h:145
The Croco library basic types definitions And global definitions.
enum CRStatus cr_style_white_space_type_to_string(enum CRWhiteSpaceType a_code, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2619
CRFontSize sv
Definition: cr-style.h:216
Various type declarations about font selection related properties.
CRNum av
actual value
Definition: cr-style.h:125
CRStyle * cr_style_dup(CRStyle *a_this)
Duplicates the current instance of CRStyle .
Definition: cr-style.c:2287
enum CRPositionType position
the positioning scheme
Definition: cr-style.h:255
CRDisplayType
Definition: cr-style.h:55
CRNum sv
specified value
Definition: cr-style.h:121
enum CRStatus cr_style_display_type_to_string(enum CRDisplayType a_code, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2484
CRFontSize av
Definition: cr-style.h:220
CRStatus
The status type returned by the methods of the croco library.
Definition: cr-utils.h:43
enum CRStatus cr_style_rgb_prop_val_to_string(CRRgbPropVal *a_prop_val, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2382
CRFontSizeVal font_size
the 'font-size' property.
Definition: cr-style.h:268
CRBorderStyle
Definition: cr-style.h:40
gulong ref_count
Definition: cr-style.h:282
The css2 style class.
Definition: cr-style.h:230
CRBoxOffsetProp
Definition: cr-style.h:202
enum CRFontWeight font_weight
Definition: cr-style.h:272
CRFontStyle
Definition: cr-fonts.h:177
CRNumProp
Definition: cr-style.h:149
CRFloatType
Definition: cr-style.h:86
CRFontVariant
Definition: cr-fonts.h:185
enum CRStatus cr_style_resolve_inherited_properties(CRStyle *a_this)
Resolves the inherited properties.
Definition: cr-style.c:1937
CRFontSize cv
Definition: cr-style.h:218
gboolean inherited_props_resolved
Definition: cr-style.h:280
CRStyle * parent_style
Definition: cr-style.h:281
CRRgbPropVal rgb_props[NB_RGB_PROPS]
color properties.
Definition: cr-style.h:243
enum CRStatus cr_style_propagate_from_parent(CRStyle *a_this)
enum CRStatus cr_style_num_prop_val_to_string(CRNumPropVal *a_prop_val, GString *a_str, guint a_nb_indent)
dump a CRNumpPropVal in a string.
Definition: cr-style.c:2328
enum CRStatus cr_style_position_type_to_string(enum CRPositionType a_code, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2557
enum CRFontStretch font_stretch
Definition: cr-style.h:273
enum CRStatus cr_style_set_style_from_decl(CRStyle *a_this, CRDeclaration *a_decl)
Walks through a css2 property declaration, and populated the according field(s) in the CRStyle struct...
Definition: cr-style.c:2012
CRStyle * cr_style_new(gboolean a_set_props_to_initial_values)
Default constructor of CRStyle.
Definition: cr-style.c:1712
CRWhiteSpaceType
Definition: cr-style.h:94
void cr_style_destroy(CRStyle *a_this)
Destructor of the CRStyle class.
Definition: cr-style.c:2845
CRFontFamily * font_family
Definition: cr-style.h:263
enum CRWhiteSpaceType white_space
the 'tex' properties
Definition: cr-style.h:278
CRNum cv
computed value
Definition: cr-style.h:123
enum CRDisplayType display
box display type
Definition: cr-style.h:252
enum CRFontVariant font_variant
Definition: cr-style.h:271
CRFontStretch
Definition: cr-fonts.h:211
enum CRStatus cr_style_to_string(CRStyle *a_this, GString **a_str, guint a_nb_indent)
Serializes in instance of CRStyle into a string.
Definition: cr-style.c:2659
An abstraction of a number (num) as defined in the css2 spec.
Definition: cr-num.h:90
enum CRStatus cr_style_ref(CRStyle *a_this)
Increases the reference count of the current instance of CRStyle.
Definition: cr-style.c:2246
CRNumPropVal num_props[NB_NUM_PROPS]
numerical properties.
Definition: cr-style.h:237
enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS]
border style properties.
Definition: cr-style.h:249
enum CRStatus cr_style_float_type_to_string(enum CRFloatType a_code, GString *a_str, guint a_nb_indent)
Definition: cr-style.c:2589
CRRgb cv
computed value
Definition: cr-style.h:143
enum CRStatus cr_style_copy(CRStyle *a_dest, CRStyle *a_src)
Copies a style data structure into another.
Definition: cr-style.c:2312
enum CRFontStyle font_style
Definition: cr-style.h:270
CRFontWeight
Definition: cr-fonts.h:192
CRBorderStyleProp
Definition: cr-style.h:191
typedefG_BEGIN_DECLS struct _CRStyle CRStyle
Definition: cr-style.h:38