Copyright (c) 2012 Kevin Wellwood
All rights reserved.
This source code is distributed under the Modified BSD License. For terms and
conditions, see license.txt.
Layout_Center centers the widget with the given size within the parent.
width
+----------+
+----------------------+
| |
| +----------+ | +
| | | | | height
| +----------+ | +
| |
+----------------------+
If 'width' or 'height' is 0 then the widget's minimum width or height,
respectively, will be used.
Layout_CenterH centers the widget with the given width horizontally
within the parent. Top and bottom are distances relative to the top and
bottom edges of the parent.
width
+---------------+
+-----------------------+ + +
| | | top | -bottom
| | | |
| +---------------+ | + | +
| | | | | |
| +---------------+ | + + |
| | | | -top
| | | bottom |
| | | |
+-----------------------+ + +
If 'top' < 0 then the widget's top will be offset from the bottom of its
container instead of the top. If 'bottom' < 0 then the widget's bottom
will be offset from the top of its container, instead of the the bottom.
Layout_CenterHY centers the widget with the given width horizontally
within the parent, using absolute vertical positioning.
width
+---------------+
+-----------------------+ + +
| | | y1 |
| +---------------+ | + | y2
| | | | |
| +---------------+ | +
| |
| |
+-----------------------+
If 'width' is 0 the widget's minimum width will be used. 'y1' is an
absolute value within the parent's content region for the top of the
widget and 'y2' is the absolute location of the bottom of the widget. If
'y1' or 'y2' is negative, then part of the widget will lie outside of its
container's content region.
Layout_LTRB positions the widget using offsets from the parent's edges;
left, top, right, and bottom.
-left
+----------------+
-right
+--------------+
left right
+------+ +--------+
+-----------------------+ + +
| | | top | -bottom
| +-------+ | + | +
| | | | | |
| +-------+ | + + |
| | | bottom | -top
| | | |
+-----------------------+ + +
'left', 'top', 'right', and 'bottom' are distances from the container's
corresponding edge. If the value is negative, the distance will be
relative to the opposite side. For example, if 'top' is negative then the
widget's top will be offset from the container's bottom edge.
Layout_LTWH positions the widget using offsets from the parent's top left
and sized using the given width and height.
width
left +-------+ -left
+------+ +--------+
+-----------------------+ +
| | | top
| +-------+ | + +
| | | | | height
| +-------+ | + +
| | |
| | | -top
+-----------------------+ +
'left' and 'top' are offsets from the container's corresponding edge.
Negative values for 'top' and 'left' are retreated as relative to the
bottom and right, respectively. If 'width' or 'height' is 0 then the
widget's minimum width or height, respectively, will be used. For
example, a negative value for 'top' indicates the offset of the bottom of
the widget from its container's bottom.
Layout_XYWH positions the widget's top left corner using offsets from the
container's top left, and sized using the given width and height. This
layout is identical to Layout_LTWH for non-negative offsets.
width
x +-------+
+------+
+-----------------------+ +
| | | y
| +-------+ | + +
| | | | | height
| +-------+ | +
| |
| |
+-----------------------+
'x' and 'y' are the absolute position of the top left corner of the
widget, relative to the top left corner of the container. For negative
values of 'x' or 'y', the widget will partially lie outside the content
region of its container. If 'width' or 'height' is 0 then the widget's
minimum width or height, respectively, will be used.