![]() |
![]() |
![]() |
CCSS Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
enum ccss_property_state_t; enum ccss_property_type_t; ccss_property_base_t * (*ccss_property_create_f) (struct ccss_grammar_ const *grammar, CRTerm const *values, void *user_data); void (*ccss_property_destroy_f) (ccss_property_base_t *self); bool (*ccss_property_convert_f) (ccss_property_base_t const *self, ccss_property_type_t target, void *value); bool (*ccss_property_factory_f) (struct ccss_grammar_ const *grammar, struct ccss_block_ *block, char const *name, CRTerm const *values, void *user_data); bool (*ccss_property_inherit_f) (struct ccss_style_ const *container_style, struct ccss_style_ *style); ccss_property_class_t; typedef ccss_property_base_t; ccss_property_generic_t; void ccss_property_init (ccss_property_base_t *self, ccss_property_class_t const *property_class);
typedef enum { CCSS_PROPERTY_STATE_INVALID = 0, CCSS_PROPERTY_STATE_NONE, CCSS_PROPERTY_STATE_INHERIT, CCSS_PROPERTY_STATE_SET, CCSS_PROPERTY_STATE_ERROR_OVERFLOW } ccss_property_state_t;
This enum must be embedded as first field in every property implementation.
TODO: turn into flags and add CCSS_PROPERTY_STATE_UNRESOLVED.
error state, invalid property. | |
property set to `none', switched off. | |
inherit property from container. | |
property is valid and set. | |
error state, used for bounds checking. |
typedef enum { CCSS_PROPERTY_TYPE_DOUBLE, CCSS_PROPERTY_TYPE_STRING } ccss_property_type_t;
Type descriptions for generic properties.
ccss_property_base_t * (*ccss_property_create_f) (struct ccss_grammar_ const *grammar, CRTerm const *values, void *user_data);
Hook function for instantiating a property.
|
the grammar associated with this property. |
|
libcroco CSS values to parse for the property, see CRTerm. |
|
user data passed to property- or function-handler. |
Returns : |
pointer to the allocated property instance or NULL if parsing fails.
|
void (*ccss_property_destroy_f) (ccss_property_base_t *self);
Hook function for deallocating a property instance.
|
pointer to property instance. |
bool (*ccss_property_convert_f) (ccss_property_base_t const *self, ccss_property_type_t target, void *value);
Hook function for converting a property instance.
|
pointer to property instance. |
|
conversion target type, see ccss_property_type_t. |
|
pointer to memory location where to place the converted value. |
Returns : |
TRUE if the conversion was successful.
|
bool (*ccss_property_factory_f) (struct ccss_grammar_ const *grammar, struct ccss_block_ *block, char const *name, CRTerm const *values, void *user_data);
Hook function to handle the creation of multiple properties from a single CSS property, e.g. `border'.
|
the grammar associated with this property. |
|
the ccss_block_t the properties will be associated to. |
|
name of the property. |
|
libcroco CSS values to parse for the property, see CRTerm. |
|
user data passed to property- or function-handler. |
Returns : |
TRUE when sucessful.
|
bool (*ccss_property_inherit_f) (struct ccss_style_ const *container_style, struct ccss_style_ *style);
Hook function to inherit multi-value properties like `border'.
|
style to inherit from. |
|
style to inherit to. |
Returns : |
TRUE if property inheritance could be resolved.
|
typedef struct { char const *name; ccss_property_create_f property_create; ccss_property_destroy_f property_destroy; ccss_property_convert_f property_convert; ccss_property_factory_f property_factory; ccss_property_inherit_f property_inherit; } ccss_property_class_t;
Property interpretation vtable entry.
char const * |
property name. |
ccss_property_create_f |
allocation hook, see ccss_property_create_f. |
ccss_property_destroy_f |
deallocation hook, see ccss_property_destroy_f. |
ccss_property_convert_f |
conversion hook, see ccss_property_convert_f. |
ccss_property_factory_f |
factory hook, see ccss_property_factory_f. |
ccss_property_inherit_f |
inherit hook, see ccss_property_inherit_f. |
typedef struct ccss_property_base_ ccss_property_base_t;
This structure has to be embedded at the beginning of every custom property.
typedef struct { ccss_property_base_t base; char *name; CRTerm *values; } ccss_property_generic_t;
Implementation of a generic, single-value property.
ccss_property_base_t |
base property. |
char * |
name of the property, e.g. color .
|
CRTerm * |
linked list of values. |
void ccss_property_init (ccss_property_base_t *self, ccss_property_class_t const *property_class);
Initializes self
, needs to be called before the property is
registered with ccss.
|
a ccss_property_base_t. |
|
a ccss_property_class_t vtable. |