|
Getting Started |
|
|
|
Overview |
|
| |
|
Your application must start KwikPeg to gain access to its GUI generation services. Once started, KwikPeg controls the creation and presentation of the GUI. Your application interacts with the GUI through the C++ objects which make up the GUI. This document describes the KwikPeg functions which you must use
to start, monitor and stop KwikPeg. It also describes the
application hooks (functions) which KwikPeg calls
as it starts up. These are functions which you must provide,
even if they are empty.
This material expands upon that provided in the
KwikPeg GUI User's Guide which you can
view in Acrobat PDF
format. | |
|
|
Startup and Shutdown |
The following KwikPeg service procedures are used to start and stop KwikPeg and to access KwikPeg state information while it is operational.
Prototypes for these functions are located in KwikPeg header file
KP_API.H. This header file is automatically included
when you include PEG header file PEG.HPP or
your KwikPeg Library Header File KP_LIB.H.
|
| |
|
|
void kp_enter(void);
|
Your application must call this function to start the KwikPeg Task. This function can be called from any task when you are ready to start using KwikPeg. This function can act as or be called from an AMX Restart Procedure.
|
| |
|
|
void kp_exit(void);
|
This function can be called from any task, including the KwikPeg Task, to force KwikPeg to shutdown. This function can act as or be called from an AMX Exit Procedure. The calling task (if not the KwikPeg Task) will be blocked until KwikPeg has terminated.
|
| |
|
|
unsigned long kp_uptime(void);
|
This function returns the number of seconds which have
elapsed since KwikPeg was last started with a call to function
kp_enter().
|
| |
|
|
unsigned long num_ticks = KP_TICK_RD();
|
This macro returns the number of KwikPeg clock ticks which have
elapsed since KwikPeg was last started with a call to function
kp_enter().
|
| |
|
|
unsigned int kp_state(unsigned int wstate, |
This function can be used to ascertain the current state of KwikPeg.
If wstate == 0, the current KwikPeg state will be
returned to the caller with no delay. In this case, mswait
will be ignored.
The caller can wait for KwikPeg to reach a particular state.
Parameter wstate identifies one or more states of interest.
If mswait == 0L, the caller will be
forced to wait forever for the condition of interest.
When mswait != 0L, the caller will be
forced to wait for up to mswait ms for KwikPeg to reach
the state of interest. If the time interval expires before KwikPeg
achieves the desired state, the caller will resume with a result of
~wstate.
The following bit masks identify the possible KwikPeg states.
State mask KP_TS_IDLE
may appear set with any other state mask.
All other state masks are mutually exclusive.
KP_TS_IDLE |
KwikPeg is idle. This state is NOT the PEG idle state.
KwikPeg is totally unavailable while in the
KP_TS_IDLE state. |
KP_TS_START |
KwikPeg is starting after a call to kp_enter(). |
KP_TS_PREP |
The KwikPeg Task has started and is preparing for PEG execution.
It calls your GUI PegAppPrep() function,
giving you your first opportunity to prepare for GUI execution.
Upon return from your function, the PEG Presentation Manager
starts up and prepares your screen for use.
If you have configured the KwikPeg Library to include support for a keyboard and/or input pointing device, the KwikPeg Task will call your ConfigurePegInput() function
to prepare the devices for use.
Your GUI PegAppInitialize() function is then called
to generate your initial screen content. |
KP_TS_RUN |
KwikPeg is actively servicing the GUI.
Upon the first entry to this state, the KwikPeg Task calls your
GUI PegAppReady() function to let you know
that KwikPeg is fully operational.
KwikPeg remains in this state, even if the KwikPeg Task has to
suspend itself to wait for events (PEG messages) to service. |
KP_TS_STOP |
KwikPeg is stopping following a call to kp_exit().
This state flag remains set until KwikPeg finally goes idle.
If you have configured the KwikPeg Library to include support for a keyboard and/or input pointing device, the KwikPeg Task will call your RestorePegInput() function
to remove the devices from service and restore them to their
original condition if deemed appropriate.
Once the PEG Presentation Manager has shut down, the KwikPeg Task terminates and re-enters the KP_TS_IDLE state.
|
|
| |
| Top of page |
Application Hooks |
Your application must provide the following procedures which KwikPeg
will call as it generates and controls your GUI. The functions will
called seqentially in the order in which they are listed below.
You must include the PEG header file PEG.HPP or
your KwikPeg Library Header File KP_LIB.H.
|
| |
|
|
void PegAppPrep(void);
|
The KwikPeg Task calls this application function before any other screen or GUI initialization takes place. This procedure can perform any initialization it deems necessary. However, it must not make use of any KwikPeg services.
|
| |
|
|
void ConfigurePegInput(void);
|
If you have configured the KwikPeg Library to include support
for a keyboard and/or input pointing device, you must provide
a ConfigurePegInput() function to prepare the
devices for use. The KwikPeg Task will call this function
as soon as the PEG Presentation Manager is ready to accept
input messages from the devices.
|
| |
|
|
void PegAppInitialize(PegPresentationManager *);
|
The KwikPeg Task calls this application function once the screen is ready and the Presentation Manager is prepared to generate a GUI. This function provides your first opportunity to create your application GUI.
|
| |
|
|
void PegAppReady(void);
|
The KwikPeg Task calls this application function after all initialization is complete and the first of your GUI windows, if any, have been generated. KwikPeg is ready to begin continuous service of your GUI windows and controls.
|
| |
|
|
void RestorePegInput(void);
|
If you have configured the KwikPeg Library to include support
for a keyboard and/or input pointing device, you must provide
a RestorePegInput() function to remove the devices
from service. The KwikPeg Task will call this function
as soon as the PEG Presentation Manager has shut down and is
no longer servicing PEG messages. You can restore the input
devices to their original condition if appropriate
within your application.
|
| |
|
|
void PegAppSpinLoop(int n);
|
If you have revised the KwikPeg I/O macro interface definitions
to require a brief delay after every device I/O instruction,
then you must provide a PegAppSpinLoop() function
which will spin in a compute bound loop for approximately
n microseconds.
|
Top of page |
|
|
|
|
| Copyright © 2000-2003 |