Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Widgets

Widgets are a C-based framework for creating UI applications. Each widget represents a visible element on the display, and lives inside of a container that manages the layout, z-ordering, focus, and event-routing for the widgets and other containers that it contains.

Widgets draw to the display through a cooperative invalidate-draw cycle. When a widget needs to update its view, it invalidates its content. The invalidation makes its way up through the container hierarchy until reaching the root container, at which point the draw cycle is initiated.

The draw cycle controls which widgets draw their content, and in what order. It preserves z-ordering of all elements, and only redraws those widgets that need to be redrawn.

Widgets represent the basic UI drawing model in Brew MP that is leveraged by the Brew MP window manager as well as the Flash application model.

Widgets are loosely based on a model-view-controller (MVC) pattern, which separates UI, controller logic, and data. In many cases, widgets combine the view and controller in a single object, but keep a separate model.

While widgets have default built-in and/or associated controllers to handle events, it is also possible to attach additional controllers (event handlers) to a widget to perform custom logic.

Some widgets are used with multiple different models to achieve different goals. For example, Frame Widget can accept media frames from a camera viewfinder (CameraFrameModel), a video player (MediaFrameModel), or other source that provides frame-based data for playback.

Widgets support properties that are exposed to controllers and applications through get/set methods. Each widget supports properties that are specific to its function, in addition to common properties such as location and extent. The visual appearance of a widget can be vastly modified by changing its properties.

For more information, see the Widgets Technology Guide in http://developer.brewmp.com/resources on the Brew MP website.