Extending the CSS parser

In CtkStyle-based engines, CtkRCStyle provided ways to extend the ctkrc parser with engine-specific extensions. This has been replaced by ctk_theming_engine_register_property(), which lets a theme engine register new properties with an arbitrary type. While there is built-in support for most basic types, it is possible to use a custom parser for the property.

The installed properties depend on the “name” property, so they should be added in the constructed() vfunc. For example, if an engine with the name "Clearlooks" installs a "focus-color" property with the type CdkRGBA, the property -Clearlooks-focus-color will be registered and accepted in CSS like this:

1
2
3
CtkEntry {
  -Clearlooks-focus-color: rgba(255, 0, 0, 1.0);
}

Widget style properties also follow a similar syntax, with the widget type name used as a prefix. For example, the CtkWidget focus-line-width style property can be modified in CSS as -CtkWidget-focus-line-width.