A manager is a widget that usually contains children, either primitives or other managers. One responsibility of a manager is to position and shape its children so that the configuration of the children is appropriate for the manager's specialized purpose. Another responsibility is to determine whether a gadget child should process an input event and, if so, to dispatch the event to that child.
The XmManager Motif widget class is the superclass for all managers. XmManager is a subclass of Core. Like XmPrimitive, XmManager has resources to control colors or pixmaps used for the foreground, shadows, and highlighting rectangle. Most managers do not have shadows or highlighting rectangles, but gadget children inherit the related resources. Managers also have resources that control keyboard traversal, and they provide callbacks for processing user requests for help. In addition, they have translations and actions for dispatching input events to gadget children, usually to the child that is the current focus of keyboard events.
XmManager is not an instantiable widget class; it is used only as a subclass for other widgets. Motif has several specialized subclasses of managers, summarized in the following sections.
A Frame is a simple manager that surrounds a single child with a shadow and a margin. A Frame can also have another child that appears as a title for the Frame.
Frames are discussed in more detail in Chapter 8.
A Scale is a manager that functions as a control. It displays a value within a range and optionally allows the user to supply a new value. Its appearance and behavior are much like those of a ScrollBar without arrows. It also has a title and can display the current value next to the slider. If the application adds other children to a Scale, the Scale positions them evenly along the rectangular area that represents the range of values, and these children then act as tic marks or value labels.
Scales are discussed in more detail in Chapter 5.
A PanedWindow arranges its children vertically from top to bottom or horizontally, and forces them all to have the same width. Each child is a pane of the window. Between each pair of panes, PanedWindow inserts an optional Separator and a control called a sash. By manipulating a sash with the mouse or keyboard, the user can increase or decrease the height of the pane above. PanedWindow has resources to control the margins, the spacing between panes, and the appearance of the sashes. Each pane of a PanedWindow has resources specifying a maximum and minimum height and whether or not either the pane itself or the PanedWindow should be allowed to resize the pane without user intervention.
PanedWindow is discussed in more detail in Chapter 8.
A ScrolledWindow manages a viewport and ScrollBars to implement a window onto a virtual scroll. The user can move the viewport to display different portions of the underlying scroll by using the ScrollBars or keyboard scrolling commands.
ScrolledWindow is capable of performing scrolling operations automatically. In this mode, the application creates the widget that represents the scroll as a child of the ScrolledWindow. The ScrolledWindow then creates a clipping window to act as the viewport, creates and manages the ScrollBars, and moves the viewport with respect to the scroll when the user issues a scrolling command.
ScrolledWindow can also allow the application to perform scrolling operations. In this mode, the application must create and manage the ScrollBars and must change the contents of the viewport in response to the user's scrolling commands.
List and Text widgets are often used as virtual scrolls. Motif has convenience routines to create List and Text widgets inside ScrolledWindows, and the resulting ScrolledList and ScrolledText widgets perform scrolling operations without intervention by the application.
MainWindow is a subclass of ScrolledWindow that is intended as the primary window in an application. In addition to a viewport and ScrollBars, MainWindow includes an optional MenuBar and an optional command window and message window.
The ScrolledWindow and MainWindow widgets are described in more detail in Chapter 8.
RowColumn implements both menus and nonmenu WorkAreas. Menus are widgets that allow the user to make choices among actions or states. Motif offers four basic kinds of menu:
One use for a nonmenu RowColumn WorkArea is to contain a set of ToggleButtons constituting a RadioBox or a CheckBox. When the user selects a ToggleButton, its state changes from on to off or from off to on. Another use is to lay out an arbitrary set of widgets in a row, column, or two-dimensional formation.
RowColumn is discussed in more detail in Chapter 6.
Dialogs are container widgets that provide a means of communicating between the user and the application. A dialog widget usually asks a question or presents some information to the user. In some cases, the application is suspended until the user provides a response.
The usual superclass for a dialog widget is XmBulletinBoard. The dialog widget can be either a BulletinBoard itself or one of its more specialized subclasses. BulletinBoard is a container with no automatically created children; it supplies general behavior needed by most dialogs. Its subclasses provide child widgets and specific behavior tailored to particular types of dialogs:
Dialogs are discussed in more detail in Chapter 7.
A DrawingArea is a manager suited for use as a canvas containing graphical objects. An application must interact with a DrawingArea at a somewhat lower level than with other Motif widgets, but a DrawingArea provides the application with more fine-grained information about events. DrawingArea has callbacks to notify the application when the widget is exposed or resized and when it receives keyboard or mouse input. An application generally must use Xlib routines to draw into the DrawingArea, and the application is responsible for updating the contents when necessary. The flexibility of a DrawingArea makes it a useful widget for implementing both graphical and text features not provided by other Motif widgets.
DrawingArea is discussed in more detail in Chapter 15.
A ComboBox widget combines the capabilities of a TextField widget and a List widget. It allows users to enter information via TextField and also provides a list of possible choices via List to complete the text entry field. The application provides an array of compound strings that will fill this list and can also set the number of items that are visible in the list. If there are more items in the list than are viewable (as defined by the value of the XmNvisibleItemCount resource), a vertical scrollbar appears that allows the user to scroll through the list. The list can be displayed at all times, or it can be dropped down by the user by clicking on the down arrow in a drop-down-style ComboBox.
The TextField field in the ComboBox can be editable or non-editable. If the TextField field is editable, the user can type directly in the text field to enter a selection. If it is not editable, typing text may invoke a matching algorithm that will attempt to make a selection from the list using the characters typed by the user. In either case, list items can be selected using the keyboard and the mouse. When an item is selected, the item is displayed in reverse colors in the list and is displayed in the TextField field of the ComboBox.
ComboBox is discussed in more detail in Chapter 6.
A SpinBox is a manager that functions as a control. It creates a pair of arrows that can be used to spin through a set of choices. The choices, which are usually related but mutually exclusive, are displayed consecutively one at a time in a single text field. Choices can be a range of numeric values or an ordered list of compound strings. The arrow buttons allow the user to advance or back up through the choices until the desired choice is displayed.
SimpleSpinBox is a ready-to-use subclass of SpinBox. The text field for a SimpleSpinBox is created automatically.
SpinBox and SimpleSpinBox are discussed in more detail in Chapter 6.
A Container is a manager that accepts only widgets that are classes or subclasses of XmIconGadget as children. It arranges these children in different formats or views depending upon its resource settings, and allows selection and manipulation of the children.
Container is discussed in more detail in Chapter 8.
A Notebook is a manager that displays only one child at a time. Each child is assigned a page number in the Notebook and is displayed by user manipulation of tab buttons and page scrollers in the Notebook.
Notebook is discussed in more detail in Chapter 8.