Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cr-style.h

Go to the documentation of this file.
00001 /* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */
00002 
00003 /*
00004  * This file is part of The Croco Library
00005  *
00006  * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org>
00007  *
00008  * This program is free software; you can redistribute it and/or
00009  * modify it under the terms of version 2.1 of the GNU Lesser General Public
00010  * License as published by the Free Software Foundation.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020  * USA
00021  */
00022 
00023 #ifndef __CR_STYLE_H__
00024 #define __CR_STYLE_H__
00025 
00026 #include "cr-utils.h"
00027 #include "cr-statement.h"
00028 #include "cr-fonts.h"
00029 
00030 /**
00031  *@file
00032  *The declaration of the #CRStyle class.
00033  */
00034 G_BEGIN_DECLS
00035 
00036 typedef struct _CRStyle CRStyle ;
00037 
00038 enum CRBorderStyle
00039 {
00040         BORDER_STYLE_NONE = 0,
00041         BORDER_STYLE_HIDDEN,
00042         BORDER_STYLE_DOTTED,
00043         BORDER_STYLE_DASHED,
00044         BORDER_STYLE_SOLID,
00045         BORDER_STYLE_DOUBLE,
00046         BORDER_STYLE_GROOVE,
00047         BORDER_STYLE_RIDGE,
00048         BORDER_STYLE_INSET,
00049         BORDER_STYLE_OUTSET
00050 } ;
00051 
00052 enum CRDisplayType
00053 {
00054         DISPLAY_NONE,
00055         DISPLAY_INLINE,
00056         DISPLAY_BLOCK,
00057         DISPLAY_LIST_ITEM,
00058         DISPLAY_RUN_IN,
00059         DISPLAY_COMPACT,
00060         DISPLAY_MARKER,
00061         DISPLAY_TABLE,
00062         DISPLAY_INLINE_TABLE,
00063         DISPLAY_TABLE_ROW_GROUP,
00064         DISPLAY_TABLE_HEADER_GROUP,
00065         DISPLAY_TABLE_FOOTER_GROUP,
00066         DISPLAY_TABLE_ROW,
00067         DISPLAY_TABLE_COLUMN_GROUP,
00068         DISPLAY_TABLE_COLUMN,
00069         DISPLAY_TABLE_CELL,
00070         DISPLAY_TABLE_CAPTION,
00071         DISPLAY_INHERIT
00072 } ;
00073 
00074 enum CRPositionType
00075 {
00076         POSITION_STATIC,
00077         POSITION_RELATIVE,
00078         POSITION_ABSOLUTE,
00079         POSITION_FIXED,
00080         POSITION_INHERIT,
00081 } ;
00082 
00083 enum CRFloatType
00084 {
00085         FLOAT_NONE,
00086         FLOAT_LEFT,
00087         FLOAT_RIGHT,
00088         FLOAT_INHERIT
00089 } ;
00090 
00091 
00092 #define BORDER_THIN 2
00093 #define BORDER_MEDIUM 4
00094 #define BORDER_THICK 6
00095 
00096 
00097 /**
00098  *A numerical css property value.
00099  *This data type is actually split in 3 parts:
00100  *1/the specified value
00101  *2/the computed value
00102  *3/the actual value.
00103  *To understand the semantic of these three parts,
00104  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
00105  */
00106 typedef struct _CRNumPropVal CRNumPropVal ;
00107 struct _CRNumPropVal
00108 {
00109         /**specified value*/
00110         CRNum sv ;
00111         /**computed value*/
00112         CRNum cv ;
00113         /**actual value*/
00114         CRNum av ;
00115 } ;
00116 
00117 /**
00118  *An rgb css property value.
00119  *This data type is actually split in 3 parts:
00120  *1/the specified value
00121  *2/the computed value
00122  *3/the actual value.
00123  *To understand the semantic of these three parts,
00124  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
00125  */
00126 typedef struct _CRRgbPropVal CRRgbPropVal ;
00127 struct _CRRgbPropVal
00128 {        
00129         /**specified value*/
00130         CRRgb sv ;
00131         /**computed value*/
00132         CRRgb cv ;
00133         /**actual value*/
00134         CRRgb av ;
00135 } ;
00136 
00137 
00138 enum CRNumProp
00139 {        
00140         NUM_PROP_TOP=0,
00141         NUM_PROP_RIGHT,
00142         NUM_PROP_BOTTOM,
00143         NUM_PROP_LEFT,/*3*/
00144 
00145         NUM_PROP_PADDING_TOP,
00146         NUM_PROP_PADDING_RIGHT,
00147         NUM_PROP_PADDING_BOTTOM,
00148         NUM_PROP_PADDING_LEFT,/*7*/
00149 
00150         NUM_PROP_BORDER_TOP,
00151         NUM_PROP_BORDER_RIGHT,
00152         NUM_PROP_BORDER_BOTTOM,
00153         NUM_PROP_BORDER_LEFT,/*11*/
00154 
00155         NUM_PROP_MARGIN_TOP,
00156         NUM_PROP_MARGIN_RIGHT,
00157         NUM_PROP_MARGIN_BOTTOM,
00158         NUM_PROP_MARGIN_LEFT,/*15*/
00159 
00160         NUM_PROP_WIDTH,
00161 
00162         /*must be last*/
00163         NB_NUM_PROPS
00164 } ;
00165 
00166 enum CRRgbProp
00167 {
00168         RGB_PROP_BORDER_TOP_COLOR = 0,
00169         RGB_PROP_BORDER_RIGHT_COLOR,
00170         RGB_PROP_BORDER_BOTTOM_COLOR,
00171         RGB_PROP_BORDER_LEFT_COLOR,
00172         RGB_PROP_COLOR,
00173         RGB_PROP_BACKGROUND_COLOR,
00174 
00175         /*must be last*/
00176         NB_RGB_PROPS
00177 } ;
00178 
00179 
00180 enum CRBorderStyleProp
00181 {
00182         BORDER_STYLE_PROP_TOP = 0,
00183         BORDER_STYLE_PROP_RIGHT,
00184         BORDER_STYLE_PROP_BOTTOM,
00185         BORDER_STYLE_PROP_LEFT,
00186         
00187         /*must be last*/
00188         NB_BORDER_STYLE_PROPS
00189 } ;
00190 
00191 enum CRBoxOffsetProp
00192 {
00193         BOX_OFFSET_PROP_TOP = 0,
00194         BOX_OFFSET_PROP_RIGHT,
00195         BOX_OFFSET_PROP_BOTTOM,
00196         BOX_OFFSET_PROP_LEFT,
00197 
00198         /*must be last*/
00199         NB_BOX_OFFSET_PROPS
00200 } ;
00201 
00202 
00203 
00204 
00205 /**
00206  *The css2 style class.
00207  *Contains computed and actual values
00208  *inferred from the declarations found
00209  *in the stylesheets.
00210  *See css2 spec chapter 6.
00211  */
00212 struct _CRStyle
00213 {
00214         /**
00215          *numerical properties.
00216          *the properties are indexed by
00217          *enum #CRNumProp. 
00218          */
00219         CRNumPropVal num_props[NB_NUM_PROPS] ;
00220 
00221         /**
00222          *color properties.
00223          *They are indexed by enum #CRRgbProp .
00224          */
00225         CRRgbPropVal rgb_props[NB_RGB_PROPS] ;
00226 
00227         /**
00228          *border style properties.
00229          *They are indexed by enum #CRBorderStyleProp .
00230          */
00231         enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS] ;
00232 
00233         /**box display type*/
00234         enum CRDisplayType display ;
00235 
00236         /**the positioning scheme*/
00237         enum CRPositionType position ;
00238 
00239         /**the float property*/
00240         enum CRFloatType float_type ;
00241 
00242         /*
00243          *the 'font-family' property.
00244          */
00245         CRFontFamily *font_family ;
00246 
00247         /**
00248          *the 'font-size' property.
00249          */
00250         CRFontSize *font_size ;
00251         CRFontSizeAdjust *font_size_adjust ;
00252         enum CRFontStyle font_style ;
00253         enum CRFontVariant font_variant ;
00254         enum CRFontWeight font_weight ;
00255         enum CRFontStretch font_stretch ;
00256 
00257         CRStyle *parent_style ;
00258         gulong ref_count ;
00259 } ;
00260 
00261 enum CRStatus cr_style_num_prop_val_to_string (CRNumPropVal *a_prop_val,
00262                                                GString *a_str,
00263                                                guint a_nb_indent) ;
00264 
00265 enum CRStatus cr_style_rgb_prop_val_to_string (CRRgbPropVal *a_prop_val,
00266                                                GString *a_str,
00267                                                guint a_nb_indent) ;
00268 
00269 enum CRStatus cr_style_border_style_to_string (enum CRBorderStyle a_prop,
00270                                                GString *a_str,
00271                                                guint a_nb_indent) ;
00272 
00273 enum CRStatus cr_style_display_type_to_string (enum CRDisplayType a_code,
00274                                                GString *a_str,
00275                                                guint a_nb_indent) ;
00276 
00277 enum CRStatus cr_style_position_type_to_string (enum CRPositionType a_code,
00278                                                 GString *a_str,
00279                                                 guint a_nb_indent) ;
00280 
00281 enum CRStatus cr_style_float_type_to_string (enum CRFloatType a_code,
00282                                              GString *a_str,
00283                                              guint a_nb_indent) ;
00284 CRStyle * cr_style_new (void) ;
00285 
00286 enum CRStatus cr_style_set_props_to_defaults (CRStyle *a_this) ;
00287 
00288 enum CRStatus cr_style_set_style_from_decl (CRStyle *a_this, CRDeclaration *a_decl) ;
00289 
00290 
00291 enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src) ;
00292 
00293 enum CRStatus cr_style_ref (CRStyle *a_this) ;
00294 
00295 gboolean cr_style_unref (CRStyle *a_this) ;
00296 
00297 void cr_style_destroy (CRStyle *a_this) ;
00298 
00299 CRStyle * cr_style_dup (CRStyle *a_this) ;
00300 
00301 enum CRStatus cr_style_to_string (CRStyle *a_this, 
00302                                   GString **a_str, 
00303                                   guint a_nb_indent) ;
00304 
00305 G_END_DECLS
00306 
00307 #endif /*__CR_STYLE_H__*/

Generated on Sat Mar 20 02:38:44 2004 for Libcroco by doxygen 1.3.5