edelib
2.1.0
|
edelib theming facility allows theming widgets, their behavior and theming full applications. It also can behave as container for other themes, like sound theme or icon theme.
At first this sounds pretty abstract and that is true: theming facility is abstracted as much as possible.
Today, themed can be everything: widget look, behavior, sound events, icons and wallpapers, fonts and etc. Some toolkits and environments provides something so called metatheme, a theme that has a bunch of other, unrelated themes like themes for icons or GUI look. edelib theming implementation behaves (at some point) as metatheme too.
To allow this, edelib::Theme implements a Scheme-like language to load, parse and eventually transform theme code. Actually, edelib::Theme provides a full Scheme language (based on TinyScheme engine), but you will often see only the small parts of it.
Theme is introducing a few terms known from other toolkits and environments, where some have pretty the same meaning and some have a different one.
Theme style is a set of elements with values. Elements can be anything, like font size or background color. When application is querying certain preferences (e.g. font size), it do that from certain style.
Each styles in the same theme must have a unique name. In the case of duplicate names, first found style will be used.
Scheme is engine for painting widgets. Scheme is term from FLTK (see Fl::scheme() in FLTK documentation) and should not be confused with Scheme language; you can see schemes for FLTK as engines for GTK+. Schemes are implemented in C++ and uses FLTK low level drawing facility to paint widget elements.
Currently schemes can't be extended and theme loader uses a few of them already built in FLTK code.
Style item is entry in one style. Style item can be e.g. font color or anything that some application see as value for theming.
Theme file is the file with one or bunch of styles. First file loaded from every theme is main.ewt (ewt here means Ede Widget Theme). Here is an example how main.ewt can look like: