Definition of a Component

Widget sets such as OSF/Motif provide simple, low-level building blocks, like buttons, scrollbars, and text fields. However, to create interesting and useful applications, you must build collections of widgets that work together to perform given tasks. For example, many applications support a system of menus, which are constructed from several individual widgets. Just as the user thinks of the menu bar as a single logical component of the user interface, ViewKit ObjectPak builds abstractions that let applications deal with a "menu" rather than the individual pieces of the menu.

C++ allows you to do exactly this: to encapsulate collections of widgets and other objects as logical entities. By creating C++ classes and providing simple, convenient manipulation functions, you can avoid the complexity of creating widgets, specifying widget locations, setting resources, assigning callbacks, and other common tasks. Furthermore, for commonly used objects like menus, you can design general-purpose classes that you can easily use in many different applications.

In ViewKit ObjectPak, the general user interface classes are referred to as components. A component not only encapsulates a collection of widgets, but also defines the behavior of the overall component. ObjectPak components are designed to implement as many commonly-used features as possible. Typically, all you need to do to use a ViewKit ObjectPak component is create a subclass of the appropriate ObjectPak class and define any application-specific behavior. Furthermore, using the ObjectPak classes as a base, you can create your own library of reusable components.