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



Chapter 14. Managing Geometry

The geometry of a widget consists of its size, location, and stacking order. Widgets often have preferred sizes and perhaps locations. For example, a Label widget may prefer to be just large enough to display the text of the label. But composite widgets usually have preferences or constraints in laying out their children, and these may conflict with the preferences of the child widgets. Furthermore, the user or the application can change a widget's geometry at any time; for example, by resizing the top-level window. Geometry management is the process by which the user, parent widgets, and child widgets negotiate the actual sizes and locations of the widgets in the application.

Following are some common occasions for geometry changes:

  1. The application manages or unmanages a child widget.

  2. The application sets a geometry resource.

  3. The application sets a resource that causes one of the geometry resources to change. For example, setting a new label for a Label widget may cause a geometry change.

  4. The user resizes a top-level window using the window manager.

  5. The user resizes a pane of a PanedWindow.

    Following are the basic Core and RectObj resources that determine widget geometry:

    XmNx

    Specifies the x coordinate of the upper left outside corner (outside the border) of the widget's window. The value is relative to the upper left inside corner (inside the border) of the parent window.

    XmNy

    Specifies the y coordinate of the upper left outside corner (outside the border) of the widget's window. The value is relative to the upper left inside corner (inside the border) of the parent window.

    XmNwidth

    Specifies the inside width (excluding the border) of the widget's window.

    XmNheight

    Specifies the inside height (excluding the border) of the widget's window.

    XmNborderWidth

    Specifies the width of the border that surrounds the widget's window on all four sides. Note, however, that you should use resources like XmNshadowThickness and XmNhighlightThickness instead of XmNborderWidth to specify border widths.


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