[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide



Managing Geometry Using BulletinBoard and DrawingArea

BulletinBoard and DrawingArea are two container widgets with similar geometry policies. These widgets have three geometry-related resources in common:

XmNmarginHeight
Specifies the amount of space between the top shadow of the widget and the top edge of any child, and between the bottom shadow of the widget and the bottom edge of any child. When the value of this resource is greater than 0, the widget ensures that the top edges of all children are below the widget's top margin.

XmNmarginWidth
Specifies the amount of space between the left shadow of the widget and the left edge of any child, and between the right shadow of the widget and the right edge of any child. When the value of this resource is greater than 0, the widget ensures that the left edges of all children are to the right of the widget's left margin.

XmNresizePolicy

Determines the widget's policy with regard to resize requests from its children. Following are the possible values:

XmRESIZE_NONE
The widget has a fixed size determined by its XmNwidth and XmNheight. The widget does not accept any geometry requests that would cause it to grow, but it may accept requests (without changing its own size) that would not cause it to grow. The widget also reports its current size as its own preferred size.

XmRESIZE_GROW
The widget can grow but not shrink. If its own parent approves, the widget accepts geometry requests that cause it to grow in order to enclose its children. It may accept requests (without changing its own size) that would not cause it to grow. When queried about its own preferred size, the widget calculates its layout and reports as its preference the greater of the calculated width and height and the current width and height.

XmRESIZE_ANY
The widget tries to accommodate geometry requests that would cause it to grow or shrink in order to enclose its children, requesting changes to its own size when necessary. When queried about its own preferred size, the widget calculates its layout and reports the calculated width and height as its preference.

In addition to these policies, BulletinBoard has geometry facilities that allow it to interact with subclasses in laying out complex collections of children. For example, SelectionBox has a List containing choices, a Text selection area, labels for the list and selection area, and three or four buttons. Usually the list appears above the selection area. The buttons appear equally spaced in a row below the selection area.

Additional children may be added to the SelectionBox after creation. The first child is used as a work area. The value of XmNchildPlacement determines if the work area is placed above or below the Text area, or above or below the List area. Additional children are laid out in the following manner:

MenuBar

The first MenuBar child is placed at the top of the window.

Buttons
All XmArrowButton, XmDrawnButton, XmPushButton, and XmToggleButton widgets or gadgets, and their subclasses are placed after the OK button in the order of their creation.

Others
The layout of additional children that are not in the above categories is undefined.


[ Previous | Next | Contents | Glossary | Home | Search ]