1 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
4 * This file is part of The Croco Library
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of version 3 of the GNU General Public
9 * License as published by the Free Software Foundation.
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.
16 * You should have received a copy of the GNU 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
21 * Author: Dodji Seketeli.
22 * See COPYRIGHTS file for copyright information.
25 #ifndef __CR_STYLE_H__
26 #define __CR_STYLE_H__
29 #include "cr-statement.h"
34 *The declaration of the #CRStyle class.
38 typedef struct _CRStyle CRStyle ;
42 BORDER_STYLE_NONE = 0,
66 DISPLAY_TABLE_ROW_GROUP,
67 DISPLAY_TABLE_HEADER_GROUP,
68 DISPLAY_TABLE_FOOTER_GROUP,
70 DISPLAY_TABLE_COLUMN_GROUP,
73 DISPLAY_TABLE_CAPTION,
103 #define BORDER_THIN 2
104 #define BORDER_MEDIUM 4
105 #define BORDER_THICK 6
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
114 *To understand the semantic of these three parts,
115 *see css2 spec chap 6.1 ("Specified, computed and actual values.").
117 typedef struct _CRNumPropVal CRNumPropVal ;
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
134 *To understand the semantic of these three parts,
135 *see css2 spec chap 6.1 ("Specified, computed and actual values.").
137 typedef struct _CRRgbPropVal CRRgbPropVal ;
156 NUM_PROP_PADDING_TOP,
157 NUM_PROP_PADDING_RIGHT,
158 NUM_PROP_PADDING_BOTTOM,
159 NUM_PROP_PADDING_LEFT,/*7*/
162 NUM_PROP_BORDER_RIGHT,
163 NUM_PROP_BORDER_BOTTOM,
164 NUM_PROP_BORDER_LEFT,/*11*/
167 NUM_PROP_MARGIN_RIGHT,
168 NUM_PROP_MARGIN_BOTTOM,
169 NUM_PROP_MARGIN_LEFT,/*15*/
179 RGB_PROP_BORDER_TOP_COLOR = 0,
180 RGB_PROP_BORDER_RIGHT_COLOR,
181 RGB_PROP_BORDER_BOTTOM_COLOR,
182 RGB_PROP_BORDER_LEFT_COLOR,
184 RGB_PROP_BACKGROUND_COLOR,
191 enum CRBorderStyleProp
193 BORDER_STYLE_PROP_TOP = 0,
194 BORDER_STYLE_PROP_RIGHT,
195 BORDER_STYLE_PROP_BOTTOM,
196 BORDER_STYLE_PROP_LEFT,
199 NB_BORDER_STYLE_PROPS
204 BOX_OFFSET_PROP_TOP = 0,
205 BOX_OFFSET_PROP_RIGHT,
206 BOX_OFFSET_PROP_BOTTOM,
207 BOX_OFFSET_PROP_LEFT,
213 typedef struct _CRFontSizeVal CRFontSizeVal ;
214 struct _CRFontSizeVal {
224 *The css2 style class.
225 *Contains computed and actual values
226 *inferred from the declarations found
228 *See css2 spec chapter 6.
233 *numerical properties.
234 *the properties are indexed by
237 CRNumPropVal num_props[NB_NUM_PROPS] ;
241 *They are indexed by enum #CRRgbProp .
243 CRRgbPropVal rgb_props[NB_RGB_PROPS] ;
246 *border style properties.
247 *They are indexed by enum #CRBorderStyleProp .
249 enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS] ;
251 /**box display type*/
252 enum CRDisplayType display ;
254 /**the positioning scheme*/
255 enum CRPositionType position ;
257 /**the float property*/
258 enum CRFloatType float_type ;
261 *the 'font-family' property.
263 CRFontFamily *font_family ;
266 *the 'font-size' property.
268 CRFontSizeVal font_size ;
269 CRFontSizeAdjust *font_size_adjust ;
270 enum CRFontStyle font_style ;
271 enum CRFontVariant font_variant ;
272 enum CRFontWeight font_weight ;
273 enum CRFontStretch font_stretch ;
276 * the 'tex' properties
278 enum CRWhiteSpaceType white_space;
280 gboolean inherited_props_resolved ;
281 CRStyle *parent_style ;
285 enum CRStatus cr_style_white_space_type_to_string (enum CRWhiteSpaceType a_code,
286 GString * a_str, guint a_nb_indent) ;
288 enum CRStatus cr_style_num_prop_val_to_string (CRNumPropVal *a_prop_val,
292 enum CRStatus cr_style_rgb_prop_val_to_string (CRRgbPropVal *a_prop_val,
296 enum CRStatus cr_style_border_style_to_string (enum CRBorderStyle a_prop,
300 enum CRStatus cr_style_display_type_to_string (enum CRDisplayType a_code,
304 enum CRStatus cr_style_position_type_to_string (enum CRPositionType a_code,
308 enum CRStatus cr_style_float_type_to_string (enum CRFloatType a_code,
312 CRStyle * cr_style_new (gboolean a_set_props_to_initial_values) ;
314 enum CRStatus cr_style_set_props_to_default_values (CRStyle *a_this) ;
315 enum CRStatus cr_style_set_props_to_initial_values (CRStyle *a_this) ;
316 enum CRStatus cr_style_resolve_inherited_properties (CRStyle *a_this) ;
317 enum CRStatus cr_style_propagate_from_parent (CRStyle *a_this);
319 enum CRStatus cr_style_set_style_from_decl (CRStyle *a_this,
320 CRDeclaration *a_decl) ;
323 enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src) ;
325 enum CRStatus cr_style_ref (CRStyle *a_this) ;
327 gboolean cr_style_unref (CRStyle *a_this) ;
329 void cr_style_destroy (CRStyle *a_this) ;
331 CRStyle * cr_style_dup (CRStyle *a_this) ;
333 enum CRStatus cr_style_to_string (CRStyle *a_this,
339 #endif /*__CR_STYLE_H__*/