../

Stylable Interface

The Stylable interface defines how objects manage styling. The stylable interface would be paired with a Style object, which contains the parsed style sheet data and performs the matching of stylables to the style sheet. The Style object would normally be a singleton and has a signal that it will emit when it changes, which the Stylable would pick up.

Advantages

  • Allows any GObject to become "stylable"
  • Seperates the style data (including context) from the object

Implementation

  • Each stylable implementation will install the properties that it needs using a GParamSpec.
    • (For example, GtkWidget might install a "background-color" property)

  • Each stylable provides implementations of the context functions:

        is_a ();
        get_container ();
        get_base_style ();
        get_id ();
        get_type ();
        get_class ();
        get_pseudo_class ();
        get_attribute ();
        get_viewport ();
  • These functions are used by the style object to match against the style sheet.

Projects/GTK+/NewThemeApi/Proposals/Styleable (last edited 2013-11-22 15:36:53 by WilliamJonMcCann)