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

cr-style.h File Reference

The declaration of the CRStyle class. More...

#include "cr-utils.h"
#include "cr-statement.h"
#include "cr-fonts.h"

Go to the source code of this file.

Data Structures

struct  _CRNumPropVal
struct  _CRRgbPropVal
struct  _CRStyle
 The css2 style class. More...


Defines

#define BORDER_THIN   2
#define BORDER_MEDIUM   4
#define BORDER_THICK   6

Typedefs

typedef _CRNumPropVal CRNumPropVal
 A numerical css property value.

typedef _CRRgbPropVal CRRgbPropVal
 An rgb css property value.


Enumerations

enum  CRBorderStyle {
  BORDER_STYLE_NONE = 0, BORDER_STYLE_HIDDEN, BORDER_STYLE_DOTTED, BORDER_STYLE_DASHED,
  BORDER_STYLE_SOLID, BORDER_STYLE_DOUBLE, BORDER_STYLE_GROOVE, BORDER_STYLE_RIDGE,
  BORDER_STYLE_INSET, BORDER_STYLE_OUTSET
}
enum  CRDisplayType {
  DISPLAY_NONE, DISPLAY_INLINE, DISPLAY_BLOCK, DISPLAY_LIST_ITEM,
  DISPLAY_RUN_IN, DISPLAY_COMPACT, DISPLAY_MARKER, DISPLAY_TABLE,
  DISPLAY_INLINE_TABLE, DISPLAY_TABLE_ROW_GROUP, DISPLAY_TABLE_HEADER_GROUP, DISPLAY_TABLE_FOOTER_GROUP,
  DISPLAY_TABLE_ROW, DISPLAY_TABLE_COLUMN_GROUP, DISPLAY_TABLE_COLUMN, DISPLAY_TABLE_CELL,
  DISPLAY_TABLE_CAPTION, DISPLAY_INHERIT
}
enum  CRPositionType {
  POSITION_STATIC, POSITION_RELATIVE, POSITION_ABSOLUTE, POSITION_FIXED,
  POSITION_INHERIT
}
enum  CRFloatType { FLOAT_NONE, FLOAT_LEFT, FLOAT_RIGHT, FLOAT_INHERIT }
enum  CRNumProp {
  NUM_PROP_TOP = 0, NUM_PROP_RIGHT, NUM_PROP_BOTTOM, NUM_PROP_LEFT,
  NUM_PROP_PADDING_TOP, NUM_PROP_PADDING_RIGHT, NUM_PROP_PADDING_BOTTOM, NUM_PROP_PADDING_LEFT,
  NUM_PROP_BORDER_TOP, NUM_PROP_BORDER_RIGHT, NUM_PROP_BORDER_BOTTOM, NUM_PROP_BORDER_LEFT,
  NUM_PROP_MARGIN_TOP, NUM_PROP_MARGIN_RIGHT, NUM_PROP_MARGIN_BOTTOM, NUM_PROP_MARGIN_LEFT,
  NUM_PROP_WIDTH, NB_NUM_PROPS
}
enum  CRRgbProp {
  RGB_PROP_BORDER_TOP_COLOR = 0, RGB_PROP_BORDER_RIGHT_COLOR, RGB_PROP_BORDER_BOTTOM_COLOR, RGB_PROP_BORDER_LEFT_COLOR,
  RGB_PROP_COLOR, RGB_PROP_BACKGROUND_COLOR, NB_RGB_PROPS
}
enum  CRBorderStyleProp {
  BORDER_STYLE_PROP_TOP = 0, BORDER_STYLE_PROP_RIGHT, BORDER_STYLE_PROP_BOTTOM, BORDER_STYLE_PROP_LEFT,
  NB_BORDER_STYLE_PROPS
}
enum  CRBoxOffsetProp {
  BOX_OFFSET_PROP_TOP = 0, BOX_OFFSET_PROP_RIGHT, BOX_OFFSET_PROP_BOTTOM, BOX_OFFSET_PROP_LEFT,
  NB_BOX_OFFSET_PROPS
}

Functions

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.

enum CRStatus cr_style_rgb_prop_val_to_string (CRRgbPropVal *a_prop_val, GString *a_str, guint a_nb_indent)
enum CRStatus cr_style_border_style_to_string (enum CRBorderStyle a_prop, GString *a_str, guint a_nb_indent)
enum CRStatus cr_style_display_type_to_string (enum CRDisplayType a_code, GString *a_str, guint a_nb_indent)
enum CRStatus cr_style_position_type_to_string (enum CRPositionType a_code, GString *a_str, guint a_nb_indent)
enum CRStatus cr_style_float_type_to_string (enum CRFloatType a_code, GString *a_str, guint a_nb_indent)
CRStylecr_style_new (void)
 Default constructor of CRStyle.

enum CRStatus cr_style_set_props_to_defaults (CRStyle *a_this)
 Sets the style properties to their default values according to the css2 spec.

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 structure.

enum CRStatus cr_style_copy (CRStyle *a_dest, CRStyle *a_src)
 Copies a style data structure into another.

enum CRStatus cr_style_ref (CRStyle *a_this)
 Increases the reference count of the current instance of CRStyle.

gboolean cr_style_unref (CRStyle *a_this)
 Decreases the reference count of the current instance of CRStyle.

void cr_style_destroy (CRStyle *a_this)
 Destructor of the CRStyle class.

CRStylecr_style_dup (CRStyle *a_this)
 Duplicates the current instance of CRStyle .

enum CRStatus cr_style_to_string (CRStyle *a_this, GString **a_str, guint a_nb_indent)
 Serializes in instance of CRStyle into a string.


Variables

typedefG_BEGIN_DECLS struct
_CRStyle 
CRStyle


Detailed Description

The declaration of the CRStyle class.

Definition in file cr-style.h.


Define Documentation

#define BORDER_MEDIUM   4
 

Definition at line 93 of file cr-style.h.

#define BORDER_THICK   6
 

Definition at line 94 of file cr-style.h.

#define BORDER_THIN   2
 

Definition at line 92 of file cr-style.h.


Typedef Documentation

typedef struct _CRNumPropVal CRNumPropVal
 

A numerical css property value.

This data type is actually split in 3 parts: 1/the specified value 2/the computed value 3/the actual value. To understand the semantic of these three parts, see css2 spec chap 6.1 ("Specified, computed and actual values.").

Definition at line 106 of file cr-style.h.

Referenced by cr_style_num_prop_val_to_string().

typedef struct _CRRgbPropVal CRRgbPropVal
 

An rgb css property value.

This data type is actually split in 3 parts: 1/the specified value 2/the computed value 3/the actual value. To understand the semantic of these three parts, see css2 spec chap 6.1 ("Specified, computed and actual values.").

Definition at line 126 of file cr-style.h.

Referenced by cr_style_rgb_prop_val_to_string().


Enumeration Type Documentation

enum CRBorderStyle
 

Enumeration values:
BORDER_STYLE_NONE 
BORDER_STYLE_HIDDEN 
BORDER_STYLE_DOTTED 
BORDER_STYLE_DASHED 
BORDER_STYLE_SOLID 
BORDER_STYLE_DOUBLE 
BORDER_STYLE_GROOVE 
BORDER_STYLE_RIDGE 
BORDER_STYLE_INSET 
BORDER_STYLE_OUTSET 

Definition at line 38 of file cr-style.h.

enum CRBorderStyleProp
 

Enumeration values:
BORDER_STYLE_PROP_TOP 
BORDER_STYLE_PROP_RIGHT 
BORDER_STYLE_PROP_BOTTOM 
BORDER_STYLE_PROP_LEFT 
NB_BORDER_STYLE_PROPS 

Definition at line 180 of file cr-style.h.

enum CRBoxOffsetProp
 

Enumeration values:
BOX_OFFSET_PROP_TOP 
BOX_OFFSET_PROP_RIGHT 
BOX_OFFSET_PROP_BOTTOM 
BOX_OFFSET_PROP_LEFT 
NB_BOX_OFFSET_PROPS 

Definition at line 191 of file cr-style.h.

enum CRDisplayType
 

Enumeration values:
DISPLAY_NONE 
DISPLAY_INLINE 
DISPLAY_BLOCK 
DISPLAY_LIST_ITEM 
DISPLAY_RUN_IN 
DISPLAY_COMPACT 
DISPLAY_MARKER 
DISPLAY_TABLE 
DISPLAY_INLINE_TABLE 
DISPLAY_TABLE_ROW_GROUP 
DISPLAY_TABLE_HEADER_GROUP 
DISPLAY_TABLE_FOOTER_GROUP 
DISPLAY_TABLE_ROW 
DISPLAY_TABLE_COLUMN_GROUP 
DISPLAY_TABLE_COLUMN 
DISPLAY_TABLE_CELL 
DISPLAY_TABLE_CAPTION 
DISPLAY_INHERIT 

Definition at line 52 of file cr-style.h.

enum CRFloatType
 

Enumeration values:
FLOAT_NONE 
FLOAT_LEFT 
FLOAT_RIGHT 
FLOAT_INHERIT 

Definition at line 83 of file cr-style.h.

enum CRNumProp
 

Enumeration values:
NUM_PROP_TOP 
NUM_PROP_RIGHT 
NUM_PROP_BOTTOM 
NUM_PROP_LEFT 
NUM_PROP_PADDING_TOP 
NUM_PROP_PADDING_RIGHT 
NUM_PROP_PADDING_BOTTOM 
NUM_PROP_PADDING_LEFT 
NUM_PROP_BORDER_TOP 
NUM_PROP_BORDER_RIGHT 
NUM_PROP_BORDER_BOTTOM 
NUM_PROP_BORDER_LEFT 
NUM_PROP_MARGIN_TOP 
NUM_PROP_MARGIN_RIGHT 
NUM_PROP_MARGIN_BOTTOM 
NUM_PROP_MARGIN_LEFT 
NUM_PROP_WIDTH 
NB_NUM_PROPS 

Definition at line 138 of file cr-style.h.

enum CRPositionType
 

Enumeration values:
POSITION_STATIC 
POSITION_RELATIVE 
POSITION_ABSOLUTE 
POSITION_FIXED 
POSITION_INHERIT 

Definition at line 74 of file cr-style.h.

enum CRRgbProp
 

Enumeration values:
RGB_PROP_BORDER_TOP_COLOR 
RGB_PROP_BORDER_RIGHT_COLOR 
RGB_PROP_BORDER_BOTTOM_COLOR 
RGB_PROP_BORDER_LEFT_COLOR 
RGB_PROP_COLOR 
RGB_PROP_BACKGROUND_COLOR 
NB_RGB_PROPS 

Definition at line 166 of file cr-style.h.


Function Documentation

enum CRStatus cr_style_border_style_to_string enum CRBorderStyle  a_prop,
GString *  a_str,
guint  a_nb_indent
 

Definition at line 2092 of file cr-style.c.

References BORDER_STYLE_DASHED, BORDER_STYLE_DOTTED, BORDER_STYLE_DOUBLE, BORDER_STYLE_GROOVE, BORDER_STYLE_HIDDEN, BORDER_STYLE_INSET, BORDER_STYLE_NONE, BORDER_STYLE_OUTSET, BORDER_STYLE_RIDGE, BORDER_STYLE_SOLID, CR_BAD_PARAM_ERROR, CR_OK, and cr_utils_dump_n_chars2().

Referenced by cr_style_to_string().

enum CRStatus cr_style_copy CRStyle a_dest,
CRStyle a_src
 

Copies a style data structure into another.

TODO: this is actually broken because it's based on memcpy although some data stuctures of CRStyle should be properly duplicated.

Parameters:
a_dest the destination style datastructure
a_src the source style datastructure.
Returns:
CR_OK upon succesfull completion, an error code otherwise

Definition at line 1978 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_OK, and CRStyle.

Referenced by cr_style_dup().

void cr_style_destroy CRStyle a_this  ) 
 

Destructor of the CRStyle class.

Parameters:
a_this the instance to destroy.

Definition at line 2449 of file cr-style.c.

Referenced by cr_style_unref().

enum CRStatus cr_style_display_type_to_string enum CRDisplayType  a_code,
GString *  a_str,
guint  a_nb_indent
 

Definition at line 2140 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_OK, cr_utils_dump_n_chars2(), DISPLAY_BLOCK, DISPLAY_COMPACT, DISPLAY_INHERIT, DISPLAY_INLINE, DISPLAY_INLINE_TABLE, DISPLAY_LIST_ITEM, DISPLAY_MARKER, DISPLAY_NONE, DISPLAY_RUN_IN, DISPLAY_TABLE, DISPLAY_TABLE_CAPTION, DISPLAY_TABLE_CELL, DISPLAY_TABLE_COLUMN, DISPLAY_TABLE_COLUMN_GROUP, DISPLAY_TABLE_FOOTER_GROUP, DISPLAY_TABLE_HEADER_GROUP, DISPLAY_TABLE_ROW, and DISPLAY_TABLE_ROW_GROUP.

Referenced by cr_style_to_string().

CRStyle* cr_style_dup CRStyle a_this  ) 
 

Duplicates the current instance of CRStyle .

The newly created instance of CRStyle must be freed using cr_style_destroy ().

Parameters:
a_this the current instance of CRStyle.
Returns:
the newly duplicated instance of CRStyle.

Definition at line 1953 of file cr-style.c.

References cr_style_copy(), cr_style_new(), cr_utils_trace_info, and CRStyle.

enum CRStatus cr_style_float_type_to_string enum CRFloatType  a_code,
GString *  a_str,
guint  a_nb_indent
 

Definition at line 2245 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_OK, FLOAT_INHERIT, FLOAT_LEFT, FLOAT_NONE, and FLOAT_RIGHT.

Referenced by cr_style_to_string().

CRStyle* cr_style_new void   ) 
 

Default constructor of CRStyle.

Definition at line 1584 of file cr-style.c.

References cr_style_set_props_to_defaults(), cr_utils_trace_info, and CRStyle.

Referenced by cr_sel_eng_get_matched_style(), and cr_style_dup().

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.

Parameters:
a_prop_val the numerical property value to dump
a_str the string to dump the numerical propertie into. Note that the string value is appended to a_str.
a_nb_indent the number white chars of indentation.

Definition at line 1994 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_ERROR, cr_num_to_string(), CR_OK, cr_utils_dump_n_chars2(), CRNumPropVal, CRStatus, _CRNumPropVal::cv, and _CRNumPropVal::sv.

Referenced by cr_style_to_string().

enum CRStatus cr_style_position_type_to_string enum CRPositionType  a_code,
GString *  a_str,
guint  a_nb_indent
 

Definition at line 2213 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_OK, cr_utils_dump_n_chars2(), POSITION_ABSOLUTE, POSITION_FIXED, POSITION_INHERIT, POSITION_RELATIVE, and POSITION_STATIC.

Referenced by cr_style_to_string().

enum CRStatus cr_style_ref CRStyle a_this  ) 
 

Increases the reference count of the current instance of CRStyle.

Parameters:
a_this the current instance of CRStyle.
Returns:
CR_OK upon successfull completion, an error code otherwise.

Definition at line 1912 of file cr-style.c.

References CR_BAD_PARAM_ERROR, and CR_OK.

enum CRStatus cr_style_rgb_prop_val_to_string CRRgbPropVal a_prop_val,
GString *  a_str,
guint  a_nb_indent
 

Definition at line 2038 of file cr-style.c.

References _CRRgbPropVal::av, CR_BAD_PARAM_ERROR, CR_ERROR, CR_OK, cr_rgb_to_string(), cr_utils_dump_n_chars2(), CRRgbPropVal, CRStatus, _CRRgbPropVal::cv, and _CRRgbPropVal::sv.

Referenced by cr_style_to_string().

enum CRStatus cr_style_set_props_to_defaults CRStyle a_this  ) 
 

Sets the style properties to their default values according to the css2 spec.

Parameters:
a_this the current instance of CRStyle.
Returns:
CR_OK upon successfull completion, an error code otherwise.

Definition at line 1609 of file cr-style.c.

References BORDER_STYLE_NONE, CR_BAD_PARAM_ERROR, cr_num_set(), CR_OK, cr_rgb_set(), cr_utils_trace_info, DISPLAY_BLOCK, FLOAT_NONE, FONT_STRETCH_NORMAL, FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL, FONT_WEIGHT_NORMAL, NB_BORDER_STYLE_PROPS, NB_NUM_PROPS, NB_RGB_PROPS, NUM_AUTO, NUM_LENGTH_PX, NUM_PROP_BORDER_BOTTOM, NUM_PROP_BORDER_LEFT, NUM_PROP_BORDER_RIGHT, NUM_PROP_BORDER_TOP, NUM_PROP_BOTTOM, NUM_PROP_LEFT, NUM_PROP_MARGIN_BOTTOM, NUM_PROP_MARGIN_LEFT, NUM_PROP_MARGIN_RIGHT, NUM_PROP_MARGIN_TOP, NUM_PROP_PADDING_BOTTOM, NUM_PROP_PADDING_LEFT, NUM_PROP_PADDING_RIGHT, NUM_PROP_PADDING_TOP, NUM_PROP_RIGHT, NUM_PROP_TOP, NUM_PROP_WIDTH, POSITION_STATIC, RGB_PROP_BACKGROUND_COLOR, and RGB_PROP_COLOR.

Referenced by cr_sel_eng_get_matched_style(), and cr_style_new().

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 structure.

If the properties or their value(s) are/is not known, sets the corresponding field(s) of CRStyle to its/their default value(s)

Parameters:
a_this the instance of CRStyle to set.
a_decl the declaration from which the CRStyle fields are set.
Returns:
CR_OK upon successfull completion, an error code otherwise.

Definition at line 1693 of file cr-style.c.

References CR_BAD_PARAM_ERROR, CR_OK, CR_UNKNOWN_TYPE_ERROR, CRDeclaration, CRPropertyID, CRStatus, CRTerm, DIR_BOTTOM, DIR_LEFT, DIR_RIGHT, DIR_TOP, PROP_ID_BACKGROUND_COLOR, PROP_ID_BORDER, PROP_ID_BORDER_BOTTOM, PROP_ID_BORDER_BOTTOM_COLOR, PROP_ID_BORDER_BOTTOM_STYLE, PROP_ID_BORDER_BOTTOM_WIDTH, PROP_ID_BORDER_LEFT, PROP_ID_BORDER_LEFT_COLOR, PROP_ID_BORDER_LEFT_STYLE, PROP_ID_BORDER_LEFT_WIDTH, PROP_ID_BORDER_RIGHT, PROP_ID_BORDER_RIGHT_COLOR, PROP_ID_BORDER_RIGHT_STYLE, PROP_ID_BORDER_RIGHT_WIDTH, PROP_ID_BORDER_TOP, PROP_ID_BORDER_TOP_COLOR, PROP_ID_BORDER_TOP_STYLE, PROP_ID_BORDER_TOP_WIDTH, PROP_ID_BOTTOM, PROP_ID_COLOR, PROP_ID_DISPLAY, PROP_ID_FLOAT, PROP_ID_FONT_FAMILY, PROP_ID_FONT_SIZE, PROP_ID_FONT_STYLE, PROP_ID_FONT_WEIGHT, PROP_ID_LEFT, PROP_ID_MARGIN, PROP_ID_MARGIN_BOTTOM, PROP_ID_MARGIN_LEFT, PROP_ID_MARGIN_RIGHT, PROP_ID_MARGIN_TOP, PROP_ID_NOT_KNOWN, PROP_ID_PADDING, PROP_ID_PADDING_BOTTOM, PROP_ID_PADDING_LEFT, PROP_ID_PADDING_RIGHT, PROP_ID_PADDING_TOP, PROP_ID_POSITION, PROP_ID_RIGHT, PROP_ID_TOP, PROP_ID_WIDTH, and _CRDeclaration::property.

enum CRStatus cr_style_to_string CRStyle a_this,
GString **  a_str,
guint  a_nb_indent
 

Serializes in instance of CRStyle into a string.

Parameters:
a_this the instance of CRStyle to serialize
a_str the string to serialise the style into. if *a_str is NULL, a new GString is instanciated, otherwise the style serialisation is appended to the existed *a_str
the number of white space char to use for indentation.
Returns:
CR_OK upon successful completion, an error code otherwise.

Definition at line 2283 of file cr-style.c.

References BORDER_STYLE_PROP_TOP, CR_BAD_PARAM_ERROR, cr_font_family_to_string(), cr_font_size_adjust_to_string(), cr_font_size_to_string(), cr_font_stretch_to_string(), cr_font_style_to_string(), cr_font_variant_to_string(), cr_font_weight_to_string(), CR_OK, cr_style_border_style_to_string(), cr_style_display_type_to_string(), cr_style_float_type_to_string(), cr_style_num_prop_val_to_string(), cr_style_position_type_to_string(), cr_style_rgb_prop_val_to_string(), cr_utils_dump_n_chars2(), NB_BORDER_STYLE_PROPS, NB_NUM_PROPS, NB_RGB_PROPS, NUM_PROP_TOP, and RGB_PROP_BORDER_TOP_COLOR.

gboolean cr_style_unref CRStyle a_this  ) 
 

Decreases the reference count of the current instance of CRStyle.

If the reference count reaches 0, the instance of CRStyle is destoyed.

Parameters:
a_this the current instance of CRStyle.
Returns:
TRUE if the instance has been destroyed, FALSE otherwise.

Definition at line 1930 of file cr-style.c.

References cr_style_destroy().


Variable Documentation

typedefG_BEGIN_DECLS struct _CRStyle CRStyle
 

Definition at line 36 of file cr-style.h.

Referenced by cr_style_copy(), cr_style_dup(), and cr_style_new().


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