manpagez: man pages & more
html files: gtk3
Home | html | info | man

Extending the CSS parser

In GtkStyle-based engines, GtkRCStyle provided ways to extend the gtkrc parser with engine-specific extensions. This has been replaced by gtk_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 GdkRGBA, the property -Clearlooks-focus-color will be registered and accepted in CSS like this:

GtkEntry {
  -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 GtkWidget focus-line-width style property can be modified in CSS as -GtkWidget-focus-line-width.

© 2000-2022
Individual documents may contain additional copyright information.