diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-02-06 19:00:51 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-02-06 19:00:51 +0100 |
commit | 2f4c8b74ebe3ccf0569eda982bbd2afc5473687b (patch) | |
tree | 50fec6031b11bd8e50188eabc350ac9c7a86bf25 /src/css.hh | |
parent | bc624c1fdb57712c71fa3c98b562924a5a27e32b (diff) |
add type to CSS properties
Diffstat (limited to 'src/css.hh')
-rw-r--r-- | src/css.hh | 38 |
1 files changed, 33 insertions, 5 deletions
@@ -14,6 +14,33 @@ typedef enum { CSS_PRIMARY_LAST, } CssPrimaryOrder; +typedef enum { + CSS_TYPE_INTEGER, /* This type is only used internally, for x-* + properties. */ + CSS_TYPE_ENUM, /* Value is i, if represented by + enum_symbols[i]. */ + CSS_TYPE_MULTI_ENUM, /* For all enum_symbols[i], 1 << i are + combined. */ + CSS_TYPE_LENGTH_PERCENTAGE, /* <length> or <percentage>. Represented by + CssLength. */ + CSS_TYPE_LENGTH, /* <length>, represented as CssLength. + Note: In some cases, CSS_TYPE_LENGTH is used + instead of CSS_TYPE_LENGTH_PERCENTAGE, + only because Dw cannot handle percentages + in this particular case (e.g. + 'margin-*-width'). */ + CSS_TYPE_COLOR, /* Represented as integer. */ + CSS_TYPE_FONT_WEIGHT, /* this very special and only used by + 'font-weight' */ + CSS_TYPE_STRING, /* <string> */ + CSS_TYPE_SYMBOL, /* Symbols, which are directly copied (as + opposed to CSS_TYPE_ENUM and + CSS_TYPE_MULTI_ENUM). Used for + 'font-family'. */ + CSS_TYPE_UNUSED /* Not yet used. Will itself get unused some + day. */ +} CssValueType; + /* * Lengths are represented as int in the following way: * @@ -195,16 +222,17 @@ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> { }; ~CssPropertyList (); - void set (CssPropertyName name, CssPropertyValue value); - inline void set (CssPropertyName name, char *value) { + void set (CssPropertyName name, CssValueType type, + CssPropertyValue value); + inline void set (CssPropertyName name, CssValueType type, char *value) { CssPropertyValue v; v.strVal = value; - set (name, v); + set (name, type, v); }; - inline void set (CssPropertyName name, int value) { + inline void set (CssPropertyName name, CssValueType type, int value) { CssPropertyValue v; v.intVal = value; - set (name, v); + set (name, type, v); }; void apply (CssPropertyList *props); void print (); |