WFrame
Overview
The basic premise is this - a container is generally
divided into regions where components are added. These regions may shift
around and be reused by lots of sets of components. As you resize a window
some regions may proportionally adjust, others remain in a specific spot.
I call these regions WFrames.
This is important to remember:
A WFrame doesn't actually exist on the screen. It has no literal coordinate
values. It can only resolve an edge value when combined with a BView. Building
edge dependencies for BViews must be described in terms of other
BViews, not WFrames. In turn those BViews may use a WFrame to associate
its edges to itself, siblings or its parent.
The enumerations defined with the header are particularly important:
enum {
USE_LITERAL = 0,
USE_PERCENT,
USE_DELTA,
USE_NONE,
USE_PARENT,
USE_SIBLING,
EDGE_LEFT,
EDGE_TOP,
EDGE_RIGHT,
EDGE_BOTTOM,
EDGE_OPPOSITE,
EDGE_ADJACENT
};
These are used to explain what edge you wuld like to arrange, with regards
to what component (sibling view or parent container) and with what positioning
mode. Refer to the overview and the sample uses in the Set() method
to get a better feel for how these enumerations are used.
|
Public Member Functions
WFrame(BView* view);
There are no parameters; all it's behavior is defined through the Set()
functions.
void Set(ulong whichEdge,
ulong whichRelation,
float howMuch);
void Set(ulong whichEdge,
ulong whichRelation,
ulong whichViewRelation,
float howMuch);
void Set(ulong whichEdge,
ulong whichRelation,
BView *whichView,
ulong whichViewRelation,
float howMuch);
These functions all you to define all the edge arrangements which are
documented in the overview of the package. Here are source examples to
help you implement different relationships among views:
|
Set(EDGE_LEFT, USE_NONE) |
|
Set(EDGE_LEFT, USE_DELTA, 10); |
|
Set(EDGE_LEFT, USE_PARENT, USE_LITERAL, 10); |
|
Set(EDGE_LEFT, USE_PARENT, USE_PERCENTAGE, 50); |
|
Set(EDGE_LEFT, USE_SIBLING, aView, EDGE_ADJACENT, 0); |
|
Set(EDGE_LEFT, USE_SIBLING, aView, EDGE_ADJACENT, 5); |
|
Set(EDGE_LEFT, USE_SIBLING, aView, EDGE_OPPOSITE, 0); |
|
Set(EDGE_LEFT, USE_SIBLING, aView, EDGE_OPPOSITE, 5); |
|
Set(EDGE_LEFT, USE_SIBLING, aView, USE_PERCENTAGE, 50); |
|
|