Themes
Overview
The implementation of the widget library allows full theme support for all widgets. There are some themes alredy implemented, but you may want to customize parts of the theme. This section describes the mechanism used for theme support and how you change either the whole or some aspects of the theme.
Theme usage
To access the current theme settings inherit from EM_SHARED_THEME. This will give you access to the three aspects of a theme - fonts, colors and delegates.
Fonts
Theme fonts are defined in the class EM_THEME_FONTS. There you can set the fonts which are used by all standard themes.
Colors
EM_THEME_COLORS defines a variety of colors which should be used by the theme. A theme doesn't have to use all of the colors but should not use any other colors. The standard themes use only these colors and thus can be customized by setting new colors.
Delegates
Every widget has a so called delegate which handles all the drawing and layout calculations.
These are defined in the class EM_THEME_DELEGATES and can be changed one by one. So a theme can
use part of other theme delegates.
Loading a theme
To load a theme call the specific load_* feature in EM_SHARED_THEME. After loading a theme you can start to customize specific fonts, colors or delegates.
Creating a theme
To create a new theme you have to provide new delegates for a part or all widgets. Have a look at the basic implementations
in the cluster
em.widget.delegates.basic. To load the theme set the specific delegates in the EM_THEME_DELEGATES class.
If you don't provide a delegate for all widgets, first load the base theme you want to use.
It is possible to create an instance of a delegate object for every widget. This provides a possibility to animate a widget
because you can save the state of the widget inside
the delegate. To create an instance per widget, provide a delegate factory which creates a new object on each call.