Resources | Resources |



Decorator widgets

A decorator widget is a container widget that contains a single child widget. The decorator changes the appearance or behavior of its child widget by drawing something on the widget before or after that widget draws itself. Note that adding a decoration may decrease the size of the widget. For example, if a widget is 10 pixels in width and 10 pixels in height and a border decoration 2 pixels in width resizes the widget, then the widget will be 6 pixels in width and 6 pixels in height.

For example, the scrollbar widget is a decorator. If a list widget is inserted into a scrollbar widget, the list widget is displayed with a scroll bar that represents the current offset within the list.

Decorator widgets include the following:

  • Blend widget
  • Border widget
  • Button widget
  • Scrollbar widget
  • Scroll indicator widget
  • Tab widget
  • Title widget
  • Viewport widget

For more information on these widgets, see Widgets reference.

Creating custom decorator widgets

In Brew MP 1.0.4 and newer versions, the ISetGetWidgetHandler interface is provided to help developers create custom decorator widgets.

If the custom decorator is based on an existing decorator, it can use ISetGetHandler to add its own handler functions for setting the decorator on a widget and getting the widget it decorates.

The custom decorator would do the following:

  1. Call IDecorator_QueryInterface() to get the ISetGetWidgetHander interface (AEEIID_ISetGetWidgetHandler) for the existing widget.
  2. Use the SETGETWIDGETHANDLERDESC_Init () macro to set up the SetGetWidgetHandlerDesc structure, which includes pointers to the set and get handler functions.
  3. Call ISetGetWidgetHandler_SetHandler() to set the handlers on the existing decorator, passing in the SetGetWidgetHandlerDesc structure as a parameter.

    Pointers to the existing handler functions are returned in the structure, so the custom decorator can call the default handler functions of the base decorator.

For more information, see ISetGetWidgetHandler in the and the Creating a custom widget how to document in on the Brew MP website.