[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]
Motif 2.1 Programmer's Guide
Managing Geometry Using RowColumn
In addition to its role as the menu widget, RowColumn
provides general-purpose layout and geometry management for child widgets
arranged in rows, columns, or grids. The default RowColumn type, XmWORK_AREA,
provides the layout features but not the menu semantics.
RowColumn's layout is controlled by two sets of resources. One set
determines the position of children within the parent. The other set specifies
whether RowColumn adjusts the internal layout characteristics of the children,
such as margins and text alignment.
The two primary resources that control child positioning are XmNorientation
and XmNpacking. XmNorientation determines whether RowColumn lays out its
children in rows or columns. When XmNorientation is XmVERTICAL--the
default for a WorkArea--the layout is column-major. When XmNorientation
is XmHORIZONTAL the layout is row-major.
XmNpacking controls the general style of the layout. The resource has three
possible values:
XmPACK_TIGHTRowColumn places children one after the other along the major dimension
(for example, in a column when XmNorientation is XmVERTICAL). It proceeds
until no more children fit along that dimension and then begins a new row or
column. When XmNorientation is XmVERTICAL and the vertical distance remaining
in the current column is too small to accommodate the child being placed,
RowColumn begins a new column if XmNresizeHeight is False or the RowColumn
cannot become larger. When placing children in a column, RowColumn does not
alter their heights, but it makes the width of each child in the column equal
to the width of the widest child in that column. Analogous rules apply to
row-major layouts. XmPACK_TIGHT is the default value for XmNpacking in a
WorkArea.
XmPACK_COLUMNRowColumn makes the width and height of each child identical. The width is
the maximum width of all children, and the height is the maximum height.
RowColumn uses the value of XmNnumColumns to determine the maximum number of
columns (in XmVERTICAL orientation) or rows (in XmHORIZONTAL orientation) to
produce. RowColumn tries to create XmNnumColumns columns (or rows) with an
equal number of children in each column (or row).
XmPACK_NONERowColumn does not change the position of any child. Unless XmNresizeWidth
is False, it tries to grow large enough to enclose the greatest x extent of
any child. Unless XmNresizeHeight is False, it tries to grow large enough to
enclose the greatest y extent of any child.
Several other resources influence the position and size of children:
XmNadjustLastThis resource applies only when XmNpacking is XmPACK_TIGHT or
XmPACK_COLUMN. When this resource is True and the orientation is vertical,
RowColumn increases the widths of children in the last column when necessary
so that all children extend to the right edge of the RowColumn. When this
resource is True and the orientation is horizontal, RowColumn increases the
heights of children in the last row when necessary so that all children extend
to the bottom edge of the RowColumn.
XmNentryBorderWhen this resource is nonzero, it specifies the border width for all
children of the RowColumn. When this resource is zero, RowColumn does not
alter the border width of its children.
XmNmarginHeightThis resource specifies the amount of space between the top edge of the
RowColumn and the first item in each column, and between the bottom edge of
the RowColumn and the last item in each column.
XmNmarginWidthThis resource specifies the amount of space between the left edge of the
RowColumn and the first item in each row, and between the right edge of the
RowColumn and the last item in each row.
XmNresizeHeightWhen this resource is True, RowColumn adjusts its own height when possible
to accommodate its children. When this resource is False, RowColumn does not
request a new height during layout.
XmNresizeWidthWhen this resource is True, RowColumn adjusts its own width when possible
to accommodate its children. When this resource is False, RowColumn does not
request a new width during layout.
XmNspacingThis resource applies only when XmNpacking is XmPACK_TIGHT or
XmPACK_COLUMN. It specifies the amount of vertical space between each child in
a vertical orientation and the amount of horizontal space between each child
in a horizontal orientation.
RowColumn also has several resources that can cause the RowColumn to change
the internal layout of some classes of children:
XmNadjustMarginThis resource applies only to children that are subclasses of XmLabel and
XmLabelGadget. When this resource is True and the orientation is vertical,
RowColumn sets the XmNmarginLeft and XmNmarginRight for all children to the
maximum values for those resources among all children. When this resource is
True and the orientation is horizontal, RowColumn sets the XmNmarginTop and
XmNmarginBottom for all children to the maximum values for those resources
among all children. In PopupMenus and PulldownMenus this resource adjusts the
margins only for button children, not for labels.
XmNentryAlignmentThis resource applies only to children that are subclasses of XmLabel and
XmLabelGadget. When XmNisAligned is True, RowColumn sets the XmNalignment of
all children to the value specified by XmNentryAlignment. Following are the
possible values:
XmALIGNMENT_BEGINNINGThe child's text or pixmap is aligned with the left edge of the
child's window.
XmALIGNMENT_CENTERThe child's text or pixmap is aligned with the center of the
child's window.
XmALIGNMENT_ENDThe child's text or pixmap is aligned with the right edge of the
child's window.
In menus, RowColumn sets the alignment only for button children, not for
labels.
XmNentryVerticalAlignmentThis resource applies only to children that are subclasses of XmLabel,
XmLabelGadget, XmText, and XmTextField. It also applies only when XmNpacking
is XmPACK_COLUMN (in either orientation) or when XmNpacking is XmPACK_TIGHT
and the orientation is horizontal. The value specifies a reference point for
aligning the children in any row:
XmALIGNMENT_BASELINE_BOTTOMCauses the last baseline of each child in a row to align with the last
baseline of the tallest child in the row. This value is applicable only when
all children in a row contain textual data.
XmALIGNMENT_BASELINE_TOPCauses the first baseline of each child in a row to align with the first
baseline of the tallest child in the row. This value is applicable only when
all children in a row contain textual data.
XmALIGNMENT_BOTTOMCauses the bottom edge of the last line of text contained in each child to
align with the bottom edge of the last line of text of the tallest child in
the row.
XmALIGNMENT_CENTERCauses the center of each child to align vertically with the center point
established by the tallest child in the row.
XmALIGNMENT_TOPCauses the top edge of the first line of text contained in each child to
align with the top edge of the first line of text of the tallest child in the
row.
XmNisAlignedWhen True, RowColumn sets the XmNalignment resources of children that are
subclasses of XmLabel or XmLabelGadget to the value specified by
XmNentryAlignment.
[ Previous |
Next |
Contents |
Glossary |
Home |
Search ]