2002-04-22 13:24:35 +04:00
|
|
|
/**
|
2002-06-21 22:16:24 +04:00
|
|
|
* $Id: css.h,v 1.5 2002/06/21 18:16:24 bursa Exp $
|
2002-04-22 13:24:35 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "css_enum.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* structures and typedefs
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef unsigned long colour; /* 0xrrggbb */
|
|
|
|
#define TRANSPARENT 0x1000000
|
|
|
|
|
|
|
|
struct css_length {
|
|
|
|
float value;
|
|
|
|
css_unit unit;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct css_style {
|
2002-06-21 22:16:24 +04:00
|
|
|
css_clear clear;
|
2002-04-22 13:24:35 +04:00
|
|
|
css_display display;
|
|
|
|
css_float float_;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum { CSS_FONT_SIZE_INHERIT,
|
|
|
|
CSS_FONT_SIZE_ABSOLUTE,
|
|
|
|
CSS_FONT_SIZE_LENGTH,
|
|
|
|
CSS_FONT_SIZE_PERCENT } size;
|
|
|
|
union {
|
|
|
|
struct css_length length;
|
2002-06-21 22:16:24 +04:00
|
|
|
float absolute;
|
2002-04-22 13:24:35 +04:00
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} font_size;
|
|
|
|
|
|
|
|
struct {
|
2002-06-21 22:16:24 +04:00
|
|
|
enum { CSS_HEIGHT_INHERIT,
|
|
|
|
CSS_HEIGHT_AUTO,
|
2002-04-22 13:24:35 +04:00
|
|
|
CSS_HEIGHT_LENGTH } height;
|
|
|
|
struct css_length length;
|
|
|
|
} height;
|
|
|
|
|
2002-06-19 01:24:21 +04:00
|
|
|
struct {
|
|
|
|
enum { CSS_LINE_HEIGHT_INHERIT,
|
|
|
|
CSS_LINE_HEIGHT_ABSOLUTE,
|
|
|
|
CSS_LINE_HEIGHT_LENGTH,
|
|
|
|
CSS_LINE_HEIGHT_PERCENT } size;
|
|
|
|
union {
|
|
|
|
float absolute;
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} line_height;
|
|
|
|
|
|
|
|
css_text_align text_align;
|
|
|
|
|
2002-04-22 13:24:35 +04:00
|
|
|
struct {
|
2002-06-19 19:17:45 +04:00
|
|
|
enum { CSS_WIDTH_INHERIT,
|
|
|
|
CSS_WIDTH_AUTO,
|
2002-04-22 13:24:35 +04:00
|
|
|
CSS_WIDTH_LENGTH,
|
|
|
|
CSS_WIDTH_PERCENT } width;
|
|
|
|
union {
|
|
|
|
struct css_length length;
|
|
|
|
float percent;
|
|
|
|
} value;
|
|
|
|
} width;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct css_stylesheet;
|
|
|
|
|
|
|
|
struct css_selector {
|
2002-06-19 01:24:21 +04:00
|
|
|
const char * element;
|
2002-04-22 13:24:35 +04:00
|
|
|
char * class;
|
|
|
|
char * id;
|
|
|
|
};
|
|
|
|
|
2002-05-05 01:17:06 +04:00
|
|
|
extern const struct css_style css_base_style;
|
|
|
|
extern const struct css_style css_empty_style;
|
|
|
|
|
2002-04-22 13:24:35 +04:00
|
|
|
/**
|
|
|
|
* interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct css_stylesheet * css_new_stylesheet(void);
|
|
|
|
void css_get_style(struct css_stylesheet * stylesheet, struct css_selector * selector,
|
|
|
|
unsigned int selectors, struct css_style * style);
|
|
|
|
void css_parse_stylesheet(struct css_stylesheet * stylesheet, char * str);
|
|
|
|
void css_dump_style(const struct css_style * const style);
|
2002-06-19 01:24:21 +04:00
|
|
|
void css_dump_stylesheet(const struct css_stylesheet * stylesheet);
|
2002-04-22 13:24:35 +04:00
|
|
|
void css_cascade(struct css_style * const style, const struct css_style * const apply);
|
2002-05-05 01:17:06 +04:00
|
|
|
void css_parse_property_list(struct css_style * style, char * str);
|
|
|
|
|