Download Portable Embedded GUI Programming Manual

Transcript
Programming with C/PEG
yPos += 4;
}
PegDrawEnd(pThing);
}
Text 10 (Drawing Outside of the Draw Function)
9.4 Determining Drawability
In order for a PegThing or derived object to draw, and to have the output of
its drawing operations appear on the screen, the object must have a
specific combination of status flags enabled. These flags govern, what is
referred to as, drawability.
These two status flags are ultimately controlled by the PegPresentation
object. When an object is made a descendant of the PegPresentation
object, the object's status is modified to include the PSF_VISIBLE flag. The
meaning of this flag is fairly self evident: The object is visible. In C/PEG, an
object can not be considered to be visible unless it is a direct descendant of
the PegPresentation object.
The second status flag may also seem as self evident as the first, but, there
are a few more rules involved. The PSF_DRAWABLE status flag is set by the
PegPresentation object on at least one branch of its child objects. That is to
say, there is always at least one child on the PegPresentation object which
has both PSF_VISIBLE and PSF_DRAWABLE status and is, therefore, drawable.
This object is always the first child of the PegPresentation object, and this
drawable status is always passed down the branch to every child of the
drawable object.
Taking this a bit further, there also may be other child objects of the
PegPresentation object who would also be considered visible, but may not
be deemed as drawable. In order for a sibling of the drawable child to be
drawable as well, its screen boundaries must not overlap the area occupied
by the first drawable child of the PegPresentation object.
These simple rules provide for an efficient execution model whereby the
application may determine object drawability by judicious use of size and
placement.
For example, if the application required two sibling objects on the screen at
the same time, both updating their displays based on some sort of external
112
C/PEG Programming Manual
Swell Software, Inc.