This section gives a brief overview of the hierarchy of widget classes in Xt and Motif. Chapter 2 discusses this hierarchy in more detail.
Xt defines the base classes for all widgets. Core is the fundamental class for all widgets that can have windows. This class has basic resources for a widget's geometry, background color, translations, and sensitivity to input. Widgetlike objects that do not have windows--called gadgets in Motif--are subclasses of RectObj. This class has geometry resources but no colors or translations.
Composite is the base class for all widgets that can have children. This class maintains a list of its children and is responsible for managing their geometry. Constraint is a subclass of Composite that maintains additional data for each child, represented by constraint resources for the child.
Shell is the base class for shell widgets. Shells envelop other widgets whose windows are children of the root window. Shells are responsible for interaction with the window manager. Shell is a subclass of Composite. Xt has the following subclasses of Shell:
Envelops widgets that the window manager should ignore, such as menus
Superclass for shells that need to interact specifically with the window manager
Subclass of WMShell that implements toolkit-specific behavior
Subclass of VendorShell for widgets such as dialogs that appear briefly on behalf of other widgets
Subclass of VendorShell for top-level widgets for components of the application
Subclass of TopLevelShell for the top-level widget that represents the application as a whole
Motif has three broad groups of widgets: primitives and gadgets, managers, and shells.
Primitives are widgets that have no children. They are commonly the fundamental units of input and output, and they are usually building blocks for composite widgets. XmPrimitive, a subclass of Core, is the base class for all primitives. XmPrimitive has basic color resources and provides keyboard traversal behavior.
XmPrimitive is used only as a superclass for classes with more specific behavior. Following are the subclasses of Motif primitives:
Used to separate other widgets; usually appears as a line.
Displays text or a pixmap. As a superclass for buttons, provides specialized behavior, such as keyboard traversal, inside menus.
XmLabel subclasses XmCascadeButton, XmDrawnButton, XmPushButton, and XmToggleButton perform some action when activated or "pressed" by the user. Subclasses have roles as menu activators, toggles, pushbuttons, and small graphics areas.
Control that moves a scroll widget horizontally or vertically with respect to a fixed viewport on the scroll.
Array of textual items from which the user can select one or more entries.
Widgets for display and possible editing of text. XmText may be multiline or constrained to a single line. XmTextField is a variant optimized for single-line text.
Gadgets are variants of primitives that have no windows. Gadgets have geometry, but they inherit colors from their parents and depend on their parents to dispatch input events to them. XmGadget, a subclass of RectObj, is the base class for gadgets. Gadget variants exist for separators, labels, and most button classes. XmIconGadget, which displays both text and a pixmap in various combinations, can be manipulated by an XmContainer widget.
See Chapter 10 for more information on the Text and TextField widgets. See Chapter 5 for more information on other primitives.
A manager is a widget that generally has children and manages their geometry. XmManager, a subclass of Constraint, is the base class for managers. This class has special responsibilities when it has gadget children. It provides color resources that its gadget children inherit, and it dispatches input events to appropriate gadgets. Following are the subclasses of Motif managers:
Surrounds a child with a shadow and a margin.
Displays a value within a range and optionally allows the user to supply a new value.
Arranges children, called panes, vertically or horizontally (from left to right or right to left, depending on XmNorientation). May also insert a control called a sash that lets the user adjust the size of a pane.
Provides a viewport onto a child widget that behaves as a virtual scroll. Manages ScrollBars to move the scroll with respect to the viewport.
Subclass of ScrolledWindow that provides support for a MenuBar and other specialized areas.
Implements menus, RadioBoxes, and CheckBoxes, usually consisting of button children. Can be used to lay out arbitrary widgets in rows, columns, or two-dimensional formations.
Superclass for dialogs, widgets that present information to the user or seek information from the user. The dialog widget may be a BulletinBoard, which provides general behavior, or a specialized subclass. Common subclasses present a list from which the user makes a selection, display filenames and allow the user to choose one, ask the user to enter a command, and display a message. One subclass, XmForm, performs general constraint-based geometry management for its children.
General-purpose manager suitable for use as a canvas for graphics operations.
Manages a collection of certain kinds of child widgets (typically, IconGadgets). These child widgets can be viewed in several different layout formats, selected using different selection types and techniques, and directly manipulated by the user. One possible use for a Container widget would be to build a graphical user interface to a file system.
Manages a TextField widget and a List widget. A user can select an item from a ComboBox by clicking on it in the List widget or by typing it directly into the TextField widget.
Allows the user to select a value from a ring of related but mutually exclusive choices which are displayed in sequence. For example, a user might use a SpinBox to select a month by clicking through the months on one ring and to select the day of the month by clicking through the days on another ring.
Organizes its children into pages, tabs, status areas, and page scrollers to simulate a real notebook. Each page of the Notebook can hold different kinds of items. For example, the first page could contain text in a Text widget, the second page might be a graphic displayed in a Label widget, and the third page might be a questionnaire managed by a Form widget.
Motif has three shell classes:
Motif-specific implementation of the Xt class. Among other responsibilities, manages communication with MWM.
Subclass of TransientShell that envelops dialogs. Cooperates with BulletinBoard in popping up and positioning transient dialogs.
Subclass of OverrideShell that envelops menus.
Motif uses a number of specialized objects that are not intended to be used in creating widgets. These objects exist primarily to hold resources and other information that would be difficult to make available in another way. XmDisplay holds resources specific to a given display, and XmScreen holds resources specific to each screen on which the application has created a widget. The drag and drop interface includes objects representing several aspects of a drag and drop transaction, including the general context, drop sites, drag icons, and data transfers.
In addition to the Motif objects provided by the standard Motif toolkit, your application may use widgets provided by other vendors. In fact, you can write your own Motif widgets. See the Motif Widget Writer's Guide for details.