|
PegThing |
|
|
|
| ||||||||||||
|
|
See Also |
|
| |
| Top of page |
Members |
|
| |
| Top of page |
Constructors:
|
| |
|
|
PegThing(const PegRect &Rect,
|
WORD wId = 0, WORD wStyle = FF_NONE)
| |
This constructor
is used when the desired initial position of the object on the screen is
known at the time of object creation. Parameter Rect contains
the starting screen coordinates, in pixels, for the object.
The wStyle parameter indicates
the object's initial drawing style.
|
| |
|
|
PegThing(WORD wId = 0,
|
WORD wStyle = FF_NONE)
| |
This constructor is used if the object position is not known at the
time of object creation. In this case, you must define the object's
position before the object is drawn on the screen.
You can set the object's position in a derived class constructor
or by sending the object a PM_SHOW message.
The easiest way to
set an object's position is to call the object's member function
Resize() passing it a PegRect argument defining
the desired screen coordinates. Note that a call to Resize()
is the only acceptable way to set an object's size or position
once the object is visible.
A more direct method of setting an object's position and size
is to directly modify the object's mReal (the absolute bounding
rectangle of an object) and mClient (the inside client area
of an object) variables. This method must be used with caution since
KwikPeg base classes must ensure that mClient remains correctly
positioned relative to mReal. Do not directly modify mReal
or mClient once an object is visible, since doing so will
usually not have the desired result because of KwikPeg's clipping enforcement.
|
| |
| Top of page |
Public Functions:
|
| |
|
|
virtual void Add(PegThing *Who,
|
BOOL bDraw = TRUE)
| |
This function adds the PegThing named Who to the
current object which can be referenced using the C++ pointer this.
Object Who becomes a child of object this.
This function is used to add windows and controls to the presentation tree.
An object is normally drawn after being added to a visible parent.
This operation can be prevented, if desired, by setting parameter bDraw
to FALSE in the call to the Add() function.
If the object Who is already a member of the current object's
child list, Who is not added to the list again.
Instead, Who is simply unlinked from the child list
and relinked at the head of the child list. This action provides a
mechanism for changing the order of child objects.
Objects are added to the parent according to the status of the object.
Hence, objects with PSF_VIEWPORT or
PSF_ALWAYS_ON_TOP status are always maintained above
child objects which do not have such status.
These differences are maintained by KwikPeg to ensure proper drawing
but are not normally of concern to your application application.
If object Who is not visible at the time this function
is called and the object this is visible, a
PM_SHOW message will be sent to object Who
to inform it that it has become visible. If the current object is not
visible at the time object Who is added to it and the current
object later becomes visible (by addition to another visible object),
PM_SHOW messages will be sent at that time to the current object
and all of its children.
Note: This function can affect the order of objects on the list of
objects that support keyboard navigation using the tab key.
See functions
SetDefaultTabLinks()
and SetTabOrder().
When constructing complex windows and dialogs, it is best to first add all of the child objects to the main window or dialog. Then add the main window or dialog to the Presentation Manager. Using this approach, screen drawing will be slightly more efficient than if you add each child object to a window or dialog that is already visible.
|
| |
|
|
virtual void AddToEnd(PegThing *Who,
|
BOOL bDraw = TRUE)
| |
This function is similar to the Add() function in all
respects except that this function makes object Who the last
child object of object this. This function can be used to
control the order of child objects when navigating through your GUI.
The navigation order is determined by the order of child objects
in the current object's list of children.
The AddToEnd() function is useful for adding objects
to PegList containers to ensure the correct order of display
of all child objects.
Like the Add() function,
objects are added to the parent according to the status of the object.
Hence, objects with PSF_VIEWPORT or
PSF_ALWAYS_ON_TOP status are always maintained above
child objects which do not have such status.
Note: This function can affect the order of objects on the list of
objects that support keyboard navigation using the tab key.
See functions
SetDefaultTabLinks()
and SetTabOrder().
|
| |
|
|
virtual void AddStatus(WORD wMask)
|
This function is used to set one or more of the status flags associated
with the current object. Function AddStatus() will logically
OR the wMask parameter into the object's mwStatus
variable. This function is used often by the KwikPeg foundation objects
to modify the state of a visible window or control. This function will
rarely be used by your application software.
See the complete list of system status flags and their definition.
|
| |
|
|
void CapturePointer(void)
|
This function acts as a wrapper function allowing access by a
PegThing to the PegPresentationManager member
function of the same name. Use of this function
is equivalent to Presentation()->CapturePointer(this).
|
| |
|
|
virtual void Center(PegThing *Who)
|
This function will adjust the screen coordinates of object Who
so that the object Who is horizontally and vertically centered
over the client area of the current object which can be referenced using
the C++ pointer this.
The object Who does not have to be a child of object
this to be centered over object this.
However, the most common use of this function is to center a child object
in the client area of its parent. The following example demonstrates
centering an object on the screen:
PegRect Rect;
Rect.Set(0, 0, 100, 100); // Create 100x100 pixel window
PegWindow *MyWin = new PegWindow(Rect);
Presentation()->Center(MyWin); // Center window on the screen
Presentation()->Add(MyWin); // Make the window visible
|
| |
|
|
virtual PegPoint CenterOf(PegThing *Who)
|
This function returns the screen coordinates of
the center of object Who.
The coordinates are returned in a PegPoint structure.
|
| |
|
|
virtual BOOL CheckDirectionalMove(
|
SIGNED iKey)
| |
This function provides the default handling for the
directional arrow keys of the keyboard input device.
This function returns TRUE if a directional
key has forced a change in input focus.
Otherwise this function returns FALSE.
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional arrow keys |
|
| |
|
|
virtual BOOL CheckSendSignal(UCHAR uSignal)
|
This function creates and sends a PegMessage to the caller's parent.
The message is constructed as follows. The SIGNAL macro is used to
encode signal uSignal as the message wType.
The object ID of the caller is the message iData.
The message source pSource is the object this.
The message pTarget is the parent object Parent().
The boolean value TRUE is returned after the signal is sent.
FALSE is returned if the signal could not be sent for one of
the following reasons: the current object has no parent,
the object ID is 0 or the specified signal bit is currently disabled.
|
| |
|
|
virtual void DefaultKeyHandler(const PegMessage &InMesg)
|
This function is the default keyboard key handler for all objects
derived from PegThing. Unless overridden, this function will
be called to process all PM_KEY messages received by the object.
This function checks for keys (such as the TAB and
ARROW keys) which can cause an input focus change. These keys are
handled explicitly by this function.
If the key is not a focus altering key, the function checks the object's
signal mask (member mwSignalMask) to determine if a
PSF_KEY_RECEIVED signal must be sent to the object's parent.
Finally, if none of these explicit keyboard operations is performed, the
key message is passed to the Message() function of the parent
of the current object.
This function may be overridden in derived classes to perform custom
key handling. However, it is more common to simply catch PM_KEY
messages in derived classes.
| This function is only present if your KwikPeg configuration has the following option enabled: | |
| Input: Keyboard |
|
| |
|
|
void Destroy(PegThing *Who)
|
This function is called to remove an object from view and delete the object,
thereby recovering the memory allocated to that object.
Since an object with no parent cannot be visible, the Destroy()
function simply deletes the object.
If an object attempts to destroy itself (Who == this),
the Destroy() function posts a message to the KwikPeg
Presentation Manager requesting it to delete the object that sent the message.
|
| |
|
|
LONG Distance(PegPoint p1, PegPoint p2)
|
This function calculates and returns the square of distance,
measured in pixels, between the two points specified by
PegPoint values p1 and p2.
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional arrow keys |
|
| |
|
|
virtual void Draw(void)
|
This function is called by the KwikPeg Presentation Manager to draw an object. It can also be called by your application when an object has been modified. This function is commonly overridden in custom classes to define a new object with a custom appearance.
Examples which illustrate the overriding of the
Draw() function are provided in Chapters 7 and 8
of the PEG Programming and Reference Manual. You can
view the manual in Acrobat PDF
format. ![]()
|
| |
|
|
virtual void DrawChildren(void)
|
This function forces each child of the current object to draw itself.
It does so by calling the child object Draw() function for each
individual child object. In your derived classes, you will not usually
call this function since the drawing of an object's children is handled
automatically by KwikPeg when the base class drawing function is executed.
However, if you override the base class Draw() function and your
custom Draw() function does not call the base class
Draw(), your version of Draw() will usually need
to call Draw() to ensure that your object's children are drawn.
Examples which illustrate the overriding of the
Draw() function are provided in Chapters 7 and 8
of the PEG Programming and Reference Manual. You can
view the manual in Acrobat PDF
format. ![]()
|
| |
|
|
virtual PegThing *Find(WORD wId,
|
BOOL bRecursive = TRUE)
| |
This function can be used to find any object based on the object ID
value assigned to the object. For example, you may create a
PegDialog window with many child controls. If you must
modify the controls as the dialog progresses, you will need to keep or
obtain pointers to these children.
There are many ways to keep track of child controls. The simplest solution
is to assign a unique object ID to each control object as it is created.
You can then use the Find() function to locate any specific control.
Be aware that the Find() function will have to search through
the children to find the object of interest.
Alternatively, you could extend definition of the dialog window to include extra data members to be used to reference each child control. Unfortunately, you will need one extra member for each control. You will also have to update each member as its control is constructed or deleted. This solution avoids the need for a search but increases the complexity of the containing object.
The following example illustrates the use of the Find() function
by an object's message handler to locate a child PegString control.
If the control has an associated text string, the IDB_OK message is
forwarded to the PegDialog message handler to close the dialog.
Otherwise, the message is discarded. For purposes of this example, it is assumed
that the PegString control has been assigned an object ID value
IDS_MY_STRING.
SIGNED MyDialog::Message(const PegMessage &Mesg)
{
switch (Mesg.wType)
{
case SIGNAL(IDB_OK, PSF_CLICKED):
PegString *pString = (PegString *) Find(IDS_MY_STRING);
if (pString->DataGet()) // Does string contain text?
{
return PegDialog::Message(Mesg);
}
break;
}
return 0;
}
|
| |
|
|
virtual PegThing *FindNearestNeighbor(
|
SIGNED iKey,
| |
PegThing *pStart, PegPoint CenterThis)
| |
|
|
virtual PegThing *FindNearestNeighbor(
|
PegThing *pStart,
| |
LONG *pPutDist, SIGNED iKey,
| |
PegPoint CenterThis, BOOL bLoose)
| |
These functions search objects starting with the object
referenced by pStart looking for the object
nearest to the point specified by CenterThis in
the direction determined by the arrow key iKey.
Only objects with the PSF_TAB_STOP status
are included in the search.
The second form of the function is used by the first to
further restrict the direction of the search.
If bLoose is FALSE, the search is
restricted to objects that are directly reachable, either vertically
or horizontally as the case may be,
from points within the current object.
If bLoose is TRUE, all objects are
included in the search.
The functions return a pointer to the nearest PegThing
object or NULL if none can be found.
If an object is found, the square of the distance from its center
to point CenterThis is stored at *pPutDist.
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional arrow keys |
|
| |
|
|
PegThing *First(void) const
|
This function returns a pointer to the first child object in the current object's child list.
|
| |
|
|
void FrameStyle(WORD wStyle)
|
This function can be used to modify the appearance of the frame
for most PegThing derived objects. This function is provided
for convenience and is nearly identical to the Style() function.
This function guarantees that only the object's frame style
will be modified, whereas the Style() function permits the
modification of all style flags.
The available frame styles are:
FF_NONE | No frame. |
FF_THIN | Thin frame. |
FF_THICK | Thick 3D frame. |
FF_RAISED | Raised 3D frame. |
FF_RECESSED | Recessed 3D frame. |
FF_MASK | Mask used to isolate frame styles. |
|
|
|
| |
|
|
WORD FrameStyle(void)
|
This functions returns the current frame style of an object.
|
| |
|
|
virtual COLORVAL GetColor(const UCHAR uIndex)
|
This function returns the object's current color value for the
particular color parameter specified by parameter uIndex.
See SetColor for a description of
color parameters and color values.
|
| |
|
|
WORD GetStatus(void)
|
This function returns the status flags associated with the current object.
See the complete list of system status flags and their definition.
|
| |
|
|
void Id(WORD wId)
|
This function assigns the value wId to the object's
mwId member thereby making wId the object ID.
The default object ID for an object is zero until this function is used
to establish a new object ID. The object ID is used by KwikPeg signaling
classes to generate a unique message type associated with each signal
notification message. For all other class types, the object ID has no effect
on the object's operation other than to provide a useful mechanism
for identifying objects at runtime using the Find() function.
|
| |
|
|
WORD Id(void)
|
This function returns the object ID, the value of the object's
mwId member. The mwId value has no effect on
the object's operation other than to provide a useful mechanism for
identifying objects at runtime using the Find() function.
Object IDs are also used when signals are sent and received. The message type used in a signal notification message is derived from the object ID and the signal reason.
|
| |
|
|
virtual void InitClient(void)
|
This function should
be called if the frame or border style of the object is modified at run
time after the object has been initialized. This function determines the
new client area rectangle based on the mReal rectangle and
the frame style. Many classes override this function to do a custom
calculation of the client area rectangle.
|
| |
|
|
virtual SIGNED Message(const PegMessage &Mesg)
|
This function is called by KwikPeg Presentation Manager to present a KwikPeg message to an object for processing. This function is the most commonly overridden of all KwikPeg functions because object behavior is often adapted by adding custom message types and message handling code.
Messages are presented in a PegMessage
structure.
System messages, signals and custom user messages are supported.
An example which illustrates the overriding of the
Message() function is provided in Chapters 7 and 8
of the PEG Programming and Reference Manual. You can
view the manual in Acrobat PDF
format. ![]()
|
| |
|
|
void MessageChildren(const PegMessage &Mesg)
|
This function passes the message indicated by Mesg
to all of the child objects of the object
which received the message.
|
| |
|
|
static PegMessageQueue *MessageQueue(void) const
|
This function returns a pointer to PegMessageQueue,
the KwikPeg object behind the KwikPeg Message Queue. You must use this
function to post messages to windows and objects and to use KwikPeg
timer services.
|
| |
|
|
virtual void MoveToFront(PegThing *Who,
|
BOOL bDraw = TRUE)
| |
This function is used to change the z-order (layering) of a parent's child objects. This function can be useful when objects overlap in the parent's client area. One object can be brought "to the front" when selected so that it is drawn on top of its siblings.
The Add() function can also be used to move an object
which is already a child to the front of the child list. However,
unlike the Add() function, the MoveToFront() function
does not change the sequential navigation order of the child objects.
The presentation tree is simply modified so that object this
becomes the first child object of its parent.
Like the Add() function, each
moved object is treated according to the status of the object.
Hence, objects with PSF_VIEWPORT or
PSF_ALWAYS_ON_TOP status are always maintained above
child objects which do not have such status.
|
| |
|
|
PegThing *Next(void) const
|
This function returns a pointer to the current object's next sibling
or NULL if the current object is at the end of the parent's
child list.
|
| |
|
|
PegThing *NextTabLink(void)
|
KwikPeg objects which accept keyboard input focus via the
tab keys (those with status PSF_TAB_STOP)
are linked together in a circular list.
The order of objects in this tab stop list is determined
automatically by function SetDefaultTabLinks()
when the parent window is displayed.
The order of objects can be altered with a call to
function SetTabOrder().
This function returns a pointer to the next object
in the tab stop list. If the current object is at the
end of the list, the head of the list is returned.
If the current object is not on the list, this function
will attempt to find the next sibling object which is on
the list. Otherwise, the head of the parent's ordered
tab stop list is returned to the caller.
If the next object cannot be determined, this function
returns NULL.
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional tab key |
|
| |
|
|
PegThing *Parent(void) const
|
This function returns a pointer to the parent object or NULL
if the object has no parent. If the object has no parent, the object
will not be visible.
|
| |
|
|
static PegPresentationManager
|
*Presentation(void) const
| |
This function returns an object's pointer to the
PegPresentationManager, the KwikPeg object behind the
KwikPeg Presentation Manager. This pointer is required to interact
directly with the top level presentation. For example, to add a new window
to the screen, you would call the KwikPeg Presentation Manager as follows:
PegWindow *MyWindow = new PegWindow(Rect);
Presentation()->Add(MyWindow);
|
| |
|
|
PegThing *Previous(void) const
|
This function returns a pointer to the current object's previous sibling
or NULL if the current object is the parent's first child.
|
| |
|
|
PegThing *PrevTabLink(void)
|
KwikPeg objects which accept keyboard input focus via the
tab keys (those with status PSF_TAB_STOP)
are linked together in a circular list.
The order of objects in this tab stop list is determined
automatically by function SetDefaultTabLinks()
when the parent window is displayed.
The order of objects can be altered with a call to
function SetTabOrder().
This function returns a pointer to the previous object
in the tab stop list. If the current object is at the
head of the list, the tail of the list is returned.
If the current object is not on the list, this function
will attempt to find the nearest preceding sibling object
which is on the list.
If the previous object cannot be determined, this function
returns NULL.
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional tab key |
|
| |
|
|
void ReleasePointer(void)
|
This function acts as a wrapper function, allowing access by a
PegThing object to the PegPresentationManager
member function of the same name. Use of this function
is equivalent to Presentation()->ReleasePointer(this).
|
| |
|
|
virtual PegThing *Remove(PegThing *Who,
|
BOOL bDraw = TRUE)
| |
This function removes a child object from the current object's child list.
This function is the opposite of function Add().
Attempting to remove an object which is not in the current object's
child list will have no effect. When an object is removed from a
visible parent, it will receive a PM_HIDE message to notify
it that it is no longer visible.
Remove() does not delete the object after removal.
In fact, the purpose of Remove() is to allow you to remove
an object from the screen without deleting it. You can then later display
the object again by simply adding it to a visible window.
To remove and delete an object, use the PegThing member function
Destroy().
|
| |
|
|
virtual void RemoveStatus(WORD wMask)
|
This function is used to clear one or more of the status flags associated
with the current object. Function RemoveStatus() will logically
AND the complement of the wMask parameter into the object's
mwStatus variable. This function is used often by the KwikPeg
foundation objects to modify the state of a visible window or control.
This function will rarely be used by your application software.
|
| |
|
|
virtual void Resize(PegRect Rect)
|
Any KwikPeg object can resize itself or any other object at any time by
calling the Resize() function. The new screen coordinates
for the object must be presented in the parameter Rect.
If you have a pointer to an object, you can resize that object by calling
its Resize() function.
The following example illustrates this concept.
PegRect Rect(10, 10, 40, 40);
PegButton *MyButton =
new PegTextButton(Rect, 0, "Hello");
:
:
: To resize MyButton, proceed as follows:
Rect.Set(20, 20, 60, 60);
MyButton->Resize(Rect);
If an object is visible when it is resized, it will automatically be invalidated and redrawn. It is acceptable to resize an object that is not visible. In fact, since redrawing is not required, it is often best to resize an object when it is invisible.
|
| |
|
|
static PegScreen *Screen(void) const
|
This function returns a pointer to the video device driver
PegScreen object. The PegScreen object provides
all of the drawing functions needed for custom drawing to the screen.
To draw directly to the screen, see the
PegScreen class description.
The Screen() function returns the static PegThing
member variable mpScreen which provides direct access to the
screen object. Although normally fixed, this variable can be altered,
albeit with extreme care. For example, member variable mpScreen
could be temporarily replaced to allow screen printing operations.
By defining a PegScreen class that drives a printer,
you could easily print any KwikPeg window by temporarily setting the
mpScreen pointer to reference your print driver's
PegScreen object. To print the screen image on the printer,
simply redraw the KwikPeg window. Then restore the mpScreen
member to its original value.
|
| |
|
|
virtual void SendSignal(UCHAR uSignal)
|
This function sends the signal uSignal
to the current object's parent.
|
| |
|
|
virtual void SetColor(const UCHAR uIndex,
|
const COLORVAL uColor)
| |
All KwikPeg objects have four color parameters which define the colors used to render the object on the screen. Each object class has its own default colors which are assigned to these color parameters.
Function SetColor() can be called to override an object's
default color assignments. The uIndex value is used to identify
which of object's color parameters is to be altered. The allowable values
for uIndex are defined as follows:
PCI_NORMAL | Set the client area fill color for normal display. |
PCI_SELECTED | Set the client area fill color to be used if the object is selected. |
PCI_NTEXT | Set the text color for normal display. |
PCI_STEXT | Set the text color to be used if the object is selected. |
Some KwikPeg objects have additional color parameters associated with them.
For example, the PegSpreadSheet object uses the following
color parameters in addition to those listed above.
PCI_SS_COLHEADBACK | Set the column header background color. |
PCI_SS_COLHEADTEXT | Set the column header text color. |
PCI_SS_ROWHEADBACK | Set the row header background color. |
PCI_SS_ROWHEADTEXT | Set the row header text color. |
PCI_SS_DIVIDER | Set the spreadsheet divider color. |
PCI_SS_BACKGROUND | Set the spreadsheet background color. |
The uColor value specifies the color to be assigned to
the object's particular color parameter. The available colors are
identified using a color ID, a numeric value defined by KwikPeg
in header file PEGTYPES.HPP
in the KwikPeg installation directory
KPGnnn\PEG\INCLUDE.
Color ID values are assigned by KwikPeg to match the color depth supported by the video device driver which you are using. The color ID is often an index into a video palette which defines the colors supported by the video device driver. However, the color ID may be an actual color code used directly by the video device driver to generate a specific screen color.
|
| |
|
|
void SetDefaultTabLinks(void)
|
KwikPeg objects which accept keyboard input focus via the
tab keys (those with status PSF_TAB_STOP)
are linked together in a circular list.
The order of objects in this tab stop list is set by this
function when the parent window is displayed.
This function is called automatically by objects derived
from the PegWindow class whenever they receive
a PM_SHOW message.
This function is also called whenever an object that can
receive keyboard input focus is added to a visible window.
The default tab order is determined by the screen position
of child objects that can accept input focus
(those with the PSF_ACCEPTS_FOCUS status).
Objects are ordered in the tab list using a top to bottom,
left to right search. The last object on the list is linked
back to the first object, making the list circular.
If a child object has already been assigned the initial focus
(has PSF_DEFAULT_FOCUS status), this function
will not alter that focus, whether or not that object is
present in the tab stop list. If no object has been assigned
the initial focus, this function will assign it to the object
which is the top-most, left-most of the objects on the list.
You can change the initial focus as follows. Find the
child object with the PSF_DEFAULT_FOCUS status.
Call that object's RemoveStatus() function
to remove its PSF_DEFAULT_FOCUS status.
Then set the initial focus for some other object by calling
that object's SetStatus() function
giving it the PSF_DEFAULT_FOCUS status.
The order of objects in the tab stop list can be altered
with a call to function
SetTabOrder()
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional tab key |
|
| |
|
|
static void SetScreenPtr(PegScreen *pScreen)
|
This function is called by the KwikPeg Task to
initialize its static pointer to the PegScreen object
maintained by your video device driver.
|
| |
|
|
void SetSignals(WORD wSendMask)
|
This function is used to identify the notification messages which
a signaling control should send to its parent.
The mask value wSendMask is a bit mask which can be used
to identify one or more signal reasons. The mask value should be created
using the SIGMASK macro.
See the complete list of signal definitions.
Not all reasons are supported by all KwikPeg classes.
Some signal reasons can be ORed together to form one parameter value,
thereby allowing you to set more than one signal reason with a single
call to the SetSignals() function. However, you must be
careful to avoid simultaneously setting multiple signal reasons that
logically conflict.
|
| |
|
|
void SetSignals(WORD wId,
|
WORD wSignalMask)
| |
This function can be used to assign the object ID wId to an object
and set the object's signal reasons according to parameter
wSignalMask.
|
| |
|
|
void SetTabOrder(WORD *pIds)
|
KwikPeg objects which accept keyboard input focus via the
tab keys (those with status PSF_TAB_STOP)
are linked together in a circular list.
This function will alter the order of objects in that
tab stop list.
Parameter pIds is a pointer to an array
of object IDs listed in the required tab stop order.
The list must be terminated with an object ID of 0.
If an object with a particular ID cannot be found, that ID
will be ignored. If an object with a particular ID does not
have the PSF_TAB_STOP status, that object
will also be ignored.
Any child object that has already been assigned the initial focus
(has PSF_DEFAULT_FOCUS status),
will have that focus removed. This function will
assign the initial focus to the first object identified
by your list of object IDs and added to the tab stop list.
You can change the focus as follows. Find the
child object with the PSF_DEFAULT_FOCUS status.
Call that object's RemoveStatus() function
to remove its PSF_DEFAULT_FOCUS status.
Then set the initial focus for some other object by calling
that object's SetStatus() function
giving it the PSF_DEFAULT_FOCUS status.
Warning: Be sure to call this function after
calling any function which adds tabbed child objects
or makes the parent object visible. Those functions will restore
the default tab stop order with their inherent call to function
SetDefaultTabLinks().
See the following example.
SIGNED MyPegClass::Message(const PegMessage &Mesg)
{
WORD wOrder[] =
{MyID_1, MyID_2, MyID_3, 0}; // Terminate with 0
switch (Mesg.wType)
{
case PM_SHOW:
PegWindow::Message(Mesg); // Sets default tab order
SetTabOrder(wOrder); // Set user-defined tab order
break;
}
return 0;
}
| This function is only present if your KwikPeg configuration has the following options enabled: | |
| Input: Keyboard | |
| Input: Support directional tab key |
|
| |
|
|
void StandardBorder(COLORVAL bFillColor)
|
This function draws the object with a standard border according to
the object's frame style. The object's mReal rectangle
will be filled with the color specified by parameter bFillColor.
|
| |
|
|
BOOL StatusIs(WORD wMask)
|
This function is used to test one or more of the status flags
associated with the current object. The status flags, common to all
KwikPeg classes, are maintained in an object's private
mwStatus variable. In most cases, your application
software should not have to modify these flags. However, you may wish to
interrogate the status flags to test for specific conditions within an object.
The StatusIs() function is provided for this purpose.
See the complete list of status flags and their definition.
|
| |
|
|
virtual void Style(WORD wStyle)
|
This function is used to set the style flags for an object.
See the complete list of style flags and their definition.
Not all style flags are supported by all KwikPeg classes.
Some style flags can be ORed together to form one style parameter,
thereby allowing you to set more than one style flag with a single call
to the Style() function. However, you must be careful
to avoid simultaneously setting multiple style flags that logically conflict.
|
| |
|
|
virtual WORD Style(void)
|
This function returns the current style flags for an object.
|
| |
|
|
UCHAR Type(void)
|
This function returns the object's enumerated type from the private
member variable muType. This function is used to determine
the class of an object.
|
| |
|
|
void Type(UCHAR uType)
|
This function assigns the value uType to the object's
private muType member. The constructor of a KwikPeg object
normally determines the object type. However, you can define new types
and use this function to establish the type of your derived objects.
|
| |
|
|
const PEGCHAR *Version(void)
|
This function returns a pointer to the KwikPeg Library version string.
|
| |
| Top of page |
Inline Wrapper Functions:
|
| |
|
|
inline void BeginDraw(void)
|
|
|
inline void BeginDraw(PegBitmap *pMap)
|
Implementation:
Screen()->BeginDraw(this);
The first form of this function is used to begin a normal drawing operation.
The second form is used to begin drawing into an off-screen bitmap created
using the CreateBitmap() or Capture() function.
|
| |
|
|
inline void Bitmap(PegPoint Where,
|
PegBitmap *Getmap, BOOL bOnTop = FALSE)
| |
Implementation:
Screen()->Bitmap(this, Where, Getmap, bOnTop)
|
| |
|
|
inline void BitmapFill(PegRect Rect,
|
PegBitmap *Getmap)
| |
Implementation:
Screen()->BitmapFill(this, Rect, Getmap);
|
| |
|
|
inline void Circle(
|
SIGNED xCenter, SIGNED yCenter,
| |
SIGNED radius, PegColor &Color,
| |
SIGNED iWidth)
| |
Implementation:
Screen()->Circle(this, xCenter, yCenter, radius, Color, iWidth);
|
| |
|
|
inline void DrawText(PegPoint Where,
|
const PEGCHAR *Text, PegColor &Color,
| |
PegFont *pFont, SIGNED Count = -1)
| |
Implementation:
Screen()->DrawText(this, Where, Text, Color, pFont, Count);
|
| |
|
|
inline void EndDraw(void)
|
|
|
inline void EndDraw(PegBitmap *pMap)
|
Implementation:
Screen()->EndDraw();
The first form of this function is used to complete a normal drawing operation.
The second form is used to complete drawing into an off-screen bitmap created
using the CreateBitmap() or Capture() functions.
|
| |
|
|
inline void Invalidate(void)
|
Implementation:
Screen()->Invalidate(mClient);
|
| |
|
|
inline void Invalidate(const PegRect &Rect)
|
Implementation:
Screen()->Invalidate(Rect);
|
| |
|
|
inline void KillTimer(WORD wId)
|
Implementation:
MessageQueue()->KillTimer(this, wId);
|
| |
|
|
inline void Line(
|
SIGNED wXStart, SIGNED wYStart,
| |
SIGNED wXEnd, SIGNED wYEnd,
| |
const PegColor &Color, SIGNED wWidth = 1)
| |
Implementation:
Screen()->Line(this, wXStart, wYStart, wXEnd, wYEnd, Color, wWidth);
|
| |
|
|
inline void Rectangle(const PegRect &Rect,
|
const PegColor &Color, SIGNED wWidth = 1)
| |
Implementation:
Screen()->Rectangle(this, Rect, Color, wWidth);
|
| |
|
|
inline void RectMove(PegRect Get, PegPoint Put)
|
Implementation:
Screen()->RectMove(this, Get, Put);
|
| |
|
|
inline void SetPointerType(UCHAR bType)
|
Implementation:
Screen()->SetPointerType(bType);
|
| |
|
|
inline void SetTimer(WORD wId,
|
LONG lCount, LONG lReset)
| |
Implementation:
MessageQueue()->SetTimer(this, wId, lCount, lReset);
|
| |
|
|
inline SIGNED TextHeight(const PEGCHAR *Text,
|
PegFont *Font)
| |
Implementation:
return Screen()->TextHeight(Text, Font);
|
| |
|
|
inline SIGNED TextWidth(const PEGCHAR *Text,
|
PegFont *Font)
| |
Implementation:
return Screen()->TextWidth(Text, Font);
|
| |
| Top of page |
Protected Members:
|
| |
|
|
WORD mwStyle
|
Object style flags.
|
| |
|
|
WORD mwId
|
Object ID value.
|
| |
| Top of page |
Public Data:
|
| |
|
|
PegRect mClient
|
This rectangle defines the client area of a window or control.
In some cases, mClient may be equal to mReal.
Generally, the bounds defined by mClient are at least
a border width smaller than the bounds specified by mReal.
Child objects are not allowed to draw outside of their parent's
mClient rectangle unless they have PSF_NONCLIENT
system status.
|
| |
|
|
PegRect mClip
|
This rectangle defines the clipping rectangle of the object.
If the object extends beyond the client area of its parent,
this rectangle may be smaller than the mReal rectangle.
|
| |
|
|
PegRect mReal
|
This rectangle defines the outer limits of an object. Objects are never allowed to draw themselves outside of this rectangle.
|
| |
| Top of page |
Client Area Bounds:
|
The PegThing data members described above define the bounds
of the drawing area associated with each PegThing object.
The diagram illustrates these parameters.
|
|
|
Top of page |
|
|
|
|
| Copyright © 2000-2003 |