Next: 1.10 How AutoLayout flags
Up: 1. Renaissance AutoLayout
Previous: 1.8 How expanding flags
1.9 AutoLayout flags
Each view has two expand/align flags, one for the horizontal, and the
other one for the vertical direction. Such flags describe how the
view should be treated with respect to additional space which could be
made available. 'Additional space' means 'space in addition to the
minimum required to display the view'. The flags for a view are
generally managed (and stored) in the container which contains the
view. Different containers will react to flags in different ways,
particularly to the align values of the flags.
Each of the horizontal and vertical flag of a view can take a value
from the following enumeration:
typedef enum
{
GSAutoLayoutExpand = 0,
GSAutoLayoutWeakExpand = 1,
GSAutoLayoutAlignMin = 2,
GSAutoLayoutAlignCenter = 3,
GSAutoLayoutAlignMax = 4
} GSAutoLayoutAlignment;
These values are now described fully.
- GSAutoLayoutExpand: The view benefits from being expanded
in that direction, typically it can provide a bigger editable area
and/or display more useful information. Editable textfields (in the
horizontal direction) and scrollviews (in both directions) are typical
examples of controls which have this flag. Containers have their flag
set to GSAutoLayoutExpand in a direction if and only if they
contain a view with the flag set to GSAutoLayoutExpand in
that direction. Typically, a window is then made resizable in a
direction if and only if its main container has this value of the
align flag in that direction. This automatically makes windows which
contains at least an element which benefits from being expanded in a
direction expandable in that direction.
- GSAutoLayoutWeakExpand: The view does not benefit from being
expanded in that direction, but whenever more space is available, it
looks prettier if the view is expanded. This value of the flag is
typically used by `spaces'. A space is an invisible view whose task
is just to expand and consume some space when the space becomes
available (usually in order to keep other controls aligned and
prettily positioned). A container has a flag set to
GSAutoLayoutWeakExpand in a direction if and only if it does
not contain any view with the flag set to GSAutoLayoutExpand
(else, its flag would be set to this), and it contains a view with the
flag set to GSAutoLayoutWeakExpand.
- GSAutoLayoutAlignCenter: The view does not benefit from being
expanded in that direction, and if more space is available, the view
would prefer the space to be distributed on the two sides of the view,
keeping the view centered in that direction. The actual
interpretation of this flag depends on the container, which migth
ignore it (as the case of the proportioned boxes, which always expands
all the contained views in their direction). This value is the
default for all views which don't have the flag set to expand.
- GSAutoLayoutAlignMin, GSAutoLayoutAlignMax: The view
does not benefit from being expanded in that direction, and if more
space is available, the view would prefer the space to be distributed
on one side of the view, so that the view is aligned towards the
minimum (or maximum) of the coordinate system in that direction. The
actual interpretation of this flag depends on the container, which
might ignore it (as in the case of the proportioned manager).
Next: 1.10 How AutoLayout flags
Up: 1. Renaissance AutoLayout
Previous: 1.8 How expanding flags
2008-03-19