Resources | Resources |



Theming Support

Theming support

In Brew 3.x, Brew UI Widgets (BUIW) provided themes that applications could use with forms and widgets. Developers provided LUA files containing tables of widget properties, which were compiled into BAR files. Forms provided interfaces to locate and apply theme properties.

In Brew MP 1.0.4, Widgets introduces themes that are managed by an instance of IThemeMgr. Developers create theme resource files, which contain CIF primitives, to define themes. The theme manager manages the theme resource files and keeps the target widgets in sync with the current theme.

Widget-based applications can use these themes to seamlessly change the look and feel of their user interface. For example, an application could use themes to display text and colors in two different ways by using a default theme and another theme for sight-impaired individuals. At runtime, users could switch between the default colors and text size and the high contrast color scheme with a large font set.

This section provides information on the following:

  • Properties and theme tags used to specify themes
  • Interfaces used in an application that uses themes
  • Writing a theme resource file and compiling it
  • Using themes in a widget-based applet

The code examples are taken from the c_widgettheming_app sample application that is on the Brew MP website in along with this technology guide.

Themed widget-based applications

A typical widget-based applet has a Root Container that contains one or more widgets. A themed widgets application also has a theme manager, as shown in the figure below. The arrows in the figure indicate a "has a" relationship. For example, the root container has a theme manager.

A theme is defined as a set of one or more theme resource files. Each theme resource defines one or more tables of properties. For more details on how properties are matched to each widget, see Theme tags. The following figure shows a theme and theme resources:

The Theme Manager manages the theme resources and the widgets that have registered for theming, applying the properties of the current theme to the registered widgets. If the application changes the theme, the theme manager re-applies the theme properties to the widgets.