Box Widget
Author: Roland Krause 2002, roland_krause@freenet.de
Description: Documentation to XawPlus

### _________________________________________________________XawPlus

### The Box Widget

Application Header file Class Header file Class Class Name Superclass | <X11/XawPlus/Box.h> <X11/XawPlus/BoxP.h> boxWidgetClass Box Composite

The Box widget provides geometry management of arbitrary widgets in a box of a specified dimension. The children are rearranged when resizing events occur either on the Box or its children, or when children are managed or unmanaged. The Box widget always attempts to pack its children as tightly as possible within the geometry allowed by its parent.

Box widgets are commonly used to manage a related set of buttons and are often called ButtonBox widgets, but the children are not limited to buttons. The Box's children are arranged on a background that has its own specified dimensions and color.

### Differences between Xaw and XawPlus

The Background color is changed from XtDefaultBackground to grey75.

### Resources

When creating a Box widget instance, the following resources are retrieved from the argument list of XtSetValues() or XtVaSetValues() or from the resource database:

Name | Class | Type | Default Value
OBJECT: |  |  |
destroyCallback | Callback | Pointer | NULL
RECTANGLE: |  |  |
borderWidth height width sensitive x y | BorderWidth Height Width Sensitive Position Position | Dimension Dimension Dimension Boolean Position Position | 1 0 0 True 0 0
CORE: |  |  |
border background mappedWhenManaged | BorderColor Background MappedWhenManaged | Pixel Pixel Boolean | XtDefaultForeground grey75 True
BOX: |  |  |
hSpace vSpace orientation | HSpace VSpace Orientation | Dimension Dimension XtOrientation | 4 4 vertical

hSpace vSpace | The amount of space, in pixels, to leave between the children. This resource specifies the amount of space left between the outermost children and the edge of the box.
orientation | Specifies whether the preferred shape of the box (i.e. the result returned by the query_geometry class method) is tall and narrow XtorientVertical or short and wide XtorientHorizontal. When the Box is a child of a parent which enforces width constraints, it is usually better to specify XtorientVertical (the default). When the parent enforces height constraints, it is usually better to specify XtorientHorizontal.

### Layout Semantic

Each time a child is managed or unmanaged, the Box widget will attempt to reposition the remaining children to compact the box. Children are positioned in order left to right or top to bottom. The packing algorithm used depends on the orientation of the Box.

XtorientVertical | When the next child does not fit on the current row, a new row is started. If a child is wider than the width of the box, the box will request a larger width from its parent and will begin the layout process from the beginning if a new width is granted.
XtorientHorizontal | When the next child does not fit in the current column, a new column is started. If a child is taller than the height of the box, the box will request a larger height from its parent and will begin the layout process from the beginning if a new height is granted.

After positioning all children, the Box widget attempts to shrink its own size to the minimum dimensions required for the layout.

### XawPlus_________________________________________________________