|
Next: Resources Up: Widgets Previous: Widget Hierarchy
Object Oriented StyleWidget sets are designed around an object oriented programming style. All widgets are associated with a particular class. For each widget class there is a set of fixed features and a set of configurable features. When a program creates a widget, it creates an instance of that widget. A program may create several instances of the same class of widget, but each may have different settings for the configurable features. For example, several push button widgets, each with a different action when activated. There is a widget class hierarchy in which widget classes have a parent widget class, or superclass, and child widget classes, or subclasses. Apart from the root, widget classes inherit features from their superclass, and then usually add a few new features of their own. Therefore, subclasses tend to have more features than superclasses. As an example, figure 17 shows a portion of the Motif widget set class hierarchy.
The Core widget class defines features common to all other widget classes, such as size and position. The Primitive widget class inherits those features from the core widget class and adds some features of its own, such as the 3-D shadows. The Label widget class then adds features to display a string or pixmap and the PushButton widget class adds features to accept user input. NB. Do confuse widget class hierarchy with the widget hierarchy described earlier. The widget class hierarchy, which is fixed for a given widget set, describes how each widget inherits features from other, ancestral widgets, etc.. Widget hierarchy describes the hierarchical assembly of widget instances in an application.
JR Pitchers Wed May 3 16:45:04 BST 1995 |
|||||||||||||||||
With any suggestions or questions please feel free to contact us |