Mechanism

The following steps describe how the styling of a Stylable object works:

  • The application creates graphic objects by loading .ilv files or by calling their constructors explicitly in C++ code. Both ways define the geometry and the graphical attributes of the objects.

  • The application may create Style Sheets and attach them to Stylists.

  • When a Stylable object is displayed, it applies a style by requesting graphical attributes to its Stylist and use them to draw itself, instead of its internal graphical attributes.

The style of the object is built by looking in each Style Sheet of the Stylist, in turn. Then, if the Stylist has a parent, the same operation is performed at the upper level. This is recursively repeated until a Stylist has no parent anymore.

Note that applying a style to a Stylable does not modify its internal graphical attributes. For instance, styling does not change the value returned by getBackground().

Limitation:

At the time of this writing, Views does not allow you to modify the objects layout. Styling only allows you to customize graphical properties, not geometry.