The Gadget class hierarchy
The Gadget class is a superclass for all of the Motif gadgets. Like Primitive, this class is a metaclass that is never
instantiated. However, gadgets are not widgets. The Gadget class is subclassed from the RectObj class, not from the
Core widget class. the figure shows the class hierarchy for gadgets.
4.3 Application Layout
While the controls are the most obvious part of a graphical user interface, these elements alone do not make an
effective interface. A random arrangement of buttons or a collection of nested menus can make an application as
obscure and as difficult to use as one with a command−line interface. The arrangement of the controls in an
application makes all the difference.
To help you lay out your application, Motif provides you with a set of manager widgets. You can think of manager
widgets as boxes in which you can put things. These boxes, however, can grow or shrink as necessary to provide the
best fit possible for the items that they contain. You can place boxes inside of other boxes, whether or not they contain
other items. By using different size boxes, you can organize things in many different ways.
Manager widgets are so named because they manage the size and position of other widgets. The relationship between
a manager widget and the widgets that it manages is commonly referred to as the parent−child model. The manager
acts as the parent, and the other widgets are its children.
Unlike primitive widgets, such as PushButtons, ScrollBars, and Labels, whose usefulness depends on their visual
appearance and interaction with the user, manager widgets provide no visual feedback and have few callback routines
that react to user input. Manager widgets have two basic purposes: they manage the sizes and positions of their
children, and they provide support for gadgets. Like other widgets, manager widgets have windows, they can receive
events, and they can be manipulated directly with Motif and Xt functions. You can draw directly into the window of a
manager widget, look for events in the widget, and specify resources for it.
There are many manager widget classes, each of which is tuned for a particular kind of widget layout. A manager
widget can manage other manager widgets, as well as primitive widgets like Labels and PushButtons. In fact, the
layout of an application is typically a kind of tree structure. As discussed in Chapter 2, The Motif Programming
Model, the top of the tree is always a shell widget like that returned by XtVaAppInitialize(). Shell widgets are
composite widgets that can only have a single managed child. This child is usually a -general−purpose manager
widget. This manager contains other managers and the primitive widgets that compose the user interface for a window
in an application.
4 Overview of the Motif Toolkit 4.3 Application Layout
52
the figure shows the all of the different manager and primitive widgets that make up the displayed dialog box. The
parent−child relationships between the widgets in this dialog box are illustrated in the tree structure shown in the
figure. Although the dialog box is composed of many different components, it appears to the user as a single,
conceptually focused user−interface object.
4 Overview of the Motif Toolkit 4.3 Application Layout
53
Get Volume 6A: Motif Programming Manual now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.