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 <pango/pango.h>
00027 #include "cr-utils.h"
00028 #include "cr-statement.h"
00029 #include "cr-fonts.h"
00030 
00031 /**
00032  *@file
00033  *The declaration of the #CRStyle class.
00034  */
00035 G_BEGIN_DECLS
00036 
00037 typedef struct _CRStyle CRStyle ;
00038 
00039 enum CRBorderStyle
00040 {
00041         BORDER_STYLE_NONE = 0,
00042         BORDER_STYLE_HIDDEN,
00043         BORDER_STYLE_DOTTED,
00044         BORDER_STYLE_DASHED,
00045         BORDER_STYLE_SOLID,
00046         BORDER_STYLE_DOUBLE,
00047         BORDER_STYLE_GROOVE,
00048         BORDER_STYLE_RIDGE,
00049         BORDER_STYLE_INSET,
00050         BORDER_STYLE_OUTSET
00051 } ;
00052 
00053 enum CRDisplayType
00054 {
00055         DISPLAY_NONE,
00056         DISPLAY_INLINE,
00057         DISPLAY_BLOCK,
00058         DISPLAY_LIST_ITEM,
00059         DISPLAY_RUN_IN,
00060         DISPLAY_COMPACT,
00061         DISPLAY_MARKER,
00062         DISPLAY_TABLE,
00063         DISPLAY_INLINE_TABLE,
00064         DISPLAY_TABLE_ROW_GROUP,
00065         DISPLAY_TABLE_HEADER_GROUP,
00066         DISPLAY_TABLE_FOOTER_GROUP,
00067         DISPLAY_TABLE_ROW,
00068         DISPLAY_TABLE_COLUMN_GROUP,
00069         DISPLAY_TABLE_COLUMN,
00070         DISPLAY_TABLE_CELL,
00071         DISPLAY_TABLE_CAPTION,
00072         DISPLAY_INHERIT
00073 } ;
00074 
00075 enum CRPositionType
00076 {
00077         POSITION_STATIC,
00078         POSITION_RELATIVE,
00079         POSITION_ABSOLUTE,
00080         POSITION_FIXED,
00081         POSITION_INHERIT,
00082 } ;
00083 
00084 enum CRFloatType
00085 {
00086         FLOAT_NONE,
00087         FLOAT_LEFT,
00088         FLOAT_RIGHT,
00089         FLOAT_INHERIT
00090 } ;
00091 
00092 
00093 #define BORDER_THIN 2
00094 #define BORDER_MEDIUM 4
00095 #define BORDER_THICK 6
00096 
00097 
00098 /**
00099  *A numerical css property value.
00100  *This data type is actually split in 3 parts:
00101  *1/the specified value
00102  *2/the computed value
00103  *3/the actual value.
00104  *To understand the semantic of these three parts,
00105  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
00106  */
00107 typedef struct _CRNumPropVal CRNumPropVal ;
00108 struct _CRNumPropVal
00109 {
00110         /**specified value*/
00111         CRNum sv ;
00112         /**computed value*/
00113         CRNum cv ;
00114         /**actual value*/
00115         CRNum av ;
00116 } ;
00117 
00118 /**
00119  *An rgb css property value.
00120  *This data type is actually split in 3 parts:
00121  *1/the specified value
00122  *2/the computed value
00123  *3/the actual value.
00124  *To understand the semantic of these three parts,
00125  *see css2 spec chap 6.1 ("Specified, computed and actual values.").
00126  */
00127 typedef struct _CRRgbPropVal CRRgbPropVal ;
00128 struct _CRRgbPropVal
00129 {        
00130         /**specified value*/
00131         CRRgb sv ;
00132         /**computed value*/
00133         CRRgb cv ;
00134         /**actual value*/
00135         CRRgb av ;
00136 } ;
00137 
00138 
00139 enum CRNumProp
00140 {        
00141         NUM_PROP_TOP=0,
00142         NUM_PROP_RIGHT,
00143         NUM_PROP_BOTTOM,
00144         NUM_PROP_LEFT,/*3*/
00145 
00146         NUM_PROP_PADDING_TOP,
00147         NUM_PROP_PADDING_RIGHT,
00148         NUM_PROP_PADDING_BOTTOM,
00149         NUM_PROP_PADDING_LEFT,/*7*/
00150 
00151         NUM_PROP_BORDER_TOP,
00152         NUM_PROP_BORDER_RIGHT,
00153         NUM_PROP_BORDER_BOTTOM,
00154         NUM_PROP_BORDER_LEFT,/*11*/
00155 
00156         NUM_PROP_MARGIN_TOP,
00157         NUM_PROP_MARGIN_RIGHT,
00158         NUM_PROP_MARGIN_BOTTOM,
00159         NUM_PROP_MARGIN_LEFT,/*15*/
00160 
00161         NUM_PROP_WIDTH,
00162 
00163         /*must be last*/
00164         NB_NUM_PROPS
00165 } ;
00166 
00167 enum CRRgbProp
00168 {
00169         RGB_PROP_BORDER_TOP_COLOR = 0,
00170         RGB_PROP_BORDER_RIGHT_COLOR,
00171         RGB_PROP_BORDER_BOTTOM_COLOR,
00172         RGB_PROP_BORDER_LEFT_COLOR,
00173         RGB_PROP_COLOR,
00174         RGB_PROP_BACKGROUND_COLOR,
00175 
00176         /*must be last*/
00177         NB_RGB_PROPS
00178 } ;
00179 
00180 
00181 enum CRBorderStyleProp
00182 {
00183         BORDER_STYLE_PROP_TOP = 0,
00184         BORDER_STYLE_PROP_RIGHT,
00185         BORDER_STYLE_PROP_BOTTOM,
00186         BORDER_STYLE_PROP_LEFT,
00187         
00188         /*must be last*/
00189         NB_BORDER_STYLE_PROPS
00190 } ;
00191 
00192 enum CRBoxOffsetProp
00193 {
00194         BOX_OFFSET_PROP_TOP = 0,
00195         BOX_OFFSET_PROP_RIGHT,
00196         BOX_OFFSET_PROP_BOTTOM,
00197         BOX_OFFSET_PROP_LEFT,
00198 
00199         /*must be last*/
00200         NB_BOX_OFFSET_PROPS
00201 } ;
00202 
00203 
00204 
00205 
00206 /**
00207  *The css2 style class.
00208  *Contains computed and actual values
00209  *of inferred from the declarations found
00210  *in the stylesheets.
00211  *See css2 spec chapter 6.
00212  */
00213 struct _CRStyle
00214 {
00215         /**
00216          *numerical properties.
00217          *the properties are indexed by
00218          *enum #CRNumProp. 
00219          */
00220         CRNumPropVal num_props[NB_NUM_PROPS] ;
00221 
00222         /**
00223          *color properties.
00224          *They are indexed by enum #CRRgbProp .
00225          */
00226         CRRgbPropVal rgb_props[NB_RGB_PROPS] ;
00227 
00228         /**
00229          *border style properties.
00230          *They are indexed by enum #CRBorderStyleProp .
00231          */
00232         enum CRBorderStyle border_style_props[NB_BORDER_STYLE_PROPS] ;
00233 
00234         /**box display type*/
00235         enum CRDisplayType display ;
00236 
00237         /**the positioning scheme*/
00238         enum CRPositionType position ;
00239 
00240         /**the float property*/
00241         enum CRFloatType float_type ;
00242 
00243         /*
00244          *the 'font-family' property.
00245          */
00246         CRFontFamily *font_family ;
00247 
00248         /**
00249          *the 'font-size' property.
00250          */
00251         CRFontSize *font_size ;
00252         CRFontSizeAdjust *font_size_adjust ;
00253         enum CRFontStyle font_style ;
00254         enum CRFontVariant font_variant ;
00255         enum CRFontWeight font_weight ;
00256         enum CRFontStretch font_stretch ;
00257 
00258         CRStyle *parent_style ;
00259         gulong ref_count ;
00260 } ;
00261 
00262 
00263 CRStyle *
00264 cr_style_new (void) ;
00265 
00266 
00267 enum CRStatus
00268 cr_style_set_style_from_decl (CRStyle *a_this, CRDeclaration *a_decl) ;
00269 
00270 enum CRStatus
00271 cr_style_to_pango_font_attributes (CRStyle *a_style,
00272                                    PangoAttrList *a_pgo_attrs,
00273                                    gulong text_len) ;
00274 enum CRStatus
00275 cr_style_ref (CRStyle *a_this) ;
00276 
00277 gboolean
00278 cr_style_unref (CRStyle *a_this) ;
00279 
00280 void
00281 cr_style_destroy (CRStyle *a_this) ;
00282 
00283 CRStyle *
00284 cr_style_dup (CRStyle *a_this) ;
00285 
00286 G_END_DECLS
00287 
00288 #endif /*__CR_STYLE_H__*/

Generated on Wed Oct 1 01:36:48 2003 for Libcroco by doxygen 1.3.3