Working with themes

How are themes stored?

There is a subdirectory for each theme. The name of this directory is the name of the theme. The directory includes the file theme.xml where the definition of the theme classes are stored. Additionally images and fonts which are used by the theme can be stored under this theme directory.

Switch to another theme

To change the theme you have to edit the diskorc.xml located under your applications <install path>/etc (Note: The filename and location may differ depending on how you load your configuration).
Change the value of the parameter "theme". Per default it is set to "default".

Global and plugin specific themes

Global themes are themes which are available for all plugins. These themes will usually be stored under <install path>/themes.

Plugin specific themes includes necessary adjustments for the global themes needed by the plugin. That means plugins should use the global themes but can change or add theme classes. Plugin specific themes will be stored under <install path>/plugins/<plugin name>/themes.

Your application should have at least the global default theme.

The four internal theme processing levels

If your plugin creates a dialog (usually with the dialog manager) the GUI internally searches for the requested window or widget theme classes.

This search is carried out in the following four levels. In this example we assume that the current theme (set in diskorc.xml) is white_theme and the plugin name is myplugin:

Level 1: Search in <install path>/plugins/myplugin/themes/white_theme/theme.xml
Level 2: Search in <install path>/plugins/myplugin/themes/default/theme.xml
Level 3: Search in <install path>/themes/white_theme/theme.xml
Level 4: Search in <install path>/themes/default/theme.xml

Note:
  • If the theme class will not be found in all four levels, default values for the particular window or widget type will be used.
  • If the theme class is multiple specified in more than one level (maybe in all four levels), the class values will be overloaded beginning from level four to level one.
  • The level four is required. The other three levels are optional.
  • If the levels one to three do not exist (e.g. the current configured theme name from diskorc.xml does not exist and/or the plugin has no specific theme files), the system works with level four only.

Example

Here we are defining a theme class of the <arrow> widget. We demonstrate the four levels of theme processing.

The current theme is "blue_eye" and the plugin name is "explugin". We begin with level four.

Level 4: <install path>/themes/default/theme.xml
<mmstheme>
    <class
        name = "myarrow"
        type = "arrow"
        bgcolor = "#000080ff"
    />
</mmstheme>
Level 3: <install path>/themes/blue_eye/theme.xml
<mmstheme>
    <class
        name = "myarrow"
        type = "arrow"
        bgcolor = "#0000b0ff"
    />
</mmstheme>
Level 2: <install path>/plugins/explugin/themes/default/theme.xml
<mmstheme>
    <class
        name = "myarrow"
        type = "arrow"
        direction = "left"
    />
</mmstheme>
Level 1: <install path>/plugins/explugin/themes/blue_eye/theme.xml
<mmstheme>
    <class
        name = "myarrow"
        type = "arrow"
        bgcolor = "#00000000"
    />
</mmstheme>
The result is an arrow class myarrow with the following values:
  • bgcolor is not set ("#00000000")
  • color is set to "#0000b0ff"
  • direction is set to "left"