First we will start with explicit location specification and move on
to several automated mechanisms.
Any node geometry can be set with SetGeometry(), but the geometry can
be altered by many mechanisms that will be described.
An EW_Window is specified relative to the lower-left corner
of the screen.
An EW_Widget is specified relative to its parent node, either a
window or widget.
Widgets are arranged in a hierarchy.
Each widget may have 0 or 1 parents and 0 or more children.
Widgets that do not have a chain of ancestors that reach to a window
(and, from such, an event context)
cannot receive events and cannot be drawn without
subverting the standard event processing mechanism.
Without any additional factors each widget is drawn and operated on
relative to its parent node and with the size given.
After an event is processed, widgets are given the opportunity to resize
themselves and to direct their children to resize.
Only in rare cases do parents forcefully resize their children using
SetGeometry().
Instead, they use a EW_Resize object which also inherits
from EW_SizeConstraints.
The parent can set these values to tell the child what size it would like.
The child uses these values along with its own.
Although, a widget's virtual Resize() is free to do what it wants,
Resize() functions generally call
EW_Widget::CheckSize(EW_Resize *resize) which goes through
the following procedure
(excluding some additional mechanisms to be mentioned later):
This procedure is independent in the X and Y dimensions.
The bound EW_BOUNDS_USE_MAX directs the mechanism to use the maximum
given by the resize from the parent.
It is rarely, if ever, used at this time.
The bound EW_BOUNDS_FILL_PARENT directs the mechanism to use the size
of the parent. This only really makes sense if the parent is a borderless
widget and this is the only child, such as within a scope.
The bound EW_BOUNDS_IGNORE_PARENT directs the mechanism to ignore
the maximum and preferred sizes from the parent's resize.
This is very useful for widgets that are set manually,
such as a WDS_Button or WDS_GetString.
Several widgets in WDS such as these, set this flag by default.
You can specify auto-sizing in the X and Y dimensions independently using
WDS_Widget::SetGeneralFlags().
The mechanism uses the border style, label, and annotation to determine
the size.
Not that this setting can optionally affect the min and max size in
addition to just the pref size.
For example, auto-sizing widgets in a partition should probably use
the setting that also affects min and max size since the partition
recognizes that as an indicator that the size is fixed.
But, widgets in a form using uniformity may not wish to alter
the min and max sizes since it would defeat the uniformity.
WDS_Form has its own child-based sizing mechanism,
so it should not use node auto-sizing.
WDS_Partition should not use node auto-sizing along its direction
of partitioning. If the children are all fixed in size, the partition
will already size itself to fit the children.
There is no conflict with node auto-sizing in the non-partitioning direction.
Note that due to limitations of many window managers, it is recommended
that window-type nodes should always have the same setting in both directions.
Stated differently,
a window should auto-size in both directions or neither direction,
never just vertically or just horizontally.
Note also the node auto-sizing provides a concept to build an interface
by pushing space requirements up the hierarchy instead of using available
space that trickles down the hierarchy.
One result is that window sizes can be only as large as required.
Auto-sized windows are not resizable using the interactive operations
of the window manager.
Care should be taken when using muliple types of auto-sizing in a hierarchy.
For example, if a child expects to get a size from a parent who tries to size
around that child, there is no stable resolution.
This usually results in rapidly flashing interfaces or widgets that move
on their own.
WDS_Form's mechanism is much more useful in its particular needs since
it is also closely concerned with placing its children.
WDS_Form can also instigate all its children to have the same size
using its uniformity capability.
This is done by giving a resize minimum equal to the largest dimension(s)
of its children.
Note that a resize minimum is not blocked by
a bound of EW_BOUNDS_IGNORE_PARENT.