Main Page   Alphabetical List   Compound List   File List   Compound Members  

PalmApp Class Reference

A base class for a Palm OS application. More...

#include <PalmApp.hpp>

List of all members.

Public Types

enum  EConst { eTimeout = 100 }
enum  EErrorCode {
  eOk = 0, eUnknownCode = appErrorClass|0x0001, eInitInstanceCode, eExitInstanceCode,
  eResetCode, eLaunchCodeCode, eNoGlobalVarsCode
}

Public Methods

 PalmApp ()
 Constructor - don't make PlamOS calls here.

virtual ~PalmApp ()
 Destructor - don't make PlamOS calls here.

uint16 GetLaunchCode () const
void SetLaunchCode (uint16)
uint16 GetFlags () const
void SetFlags (uint16)
uint32 GetExitCode () const
void SetExitCode (uint32)
const void * GetCommandPBP () const
void SetCommandPBP (const void *)
const EventType & GetCurrEvent () const
int32 GetTimeout () const
void SetTimeout (int32)
uint32 PilotMain (uint16, void *, uint16)

Static Public Methods

void Quit ()

Protected Methods

virtual void InitInstance ()
 Intialization routine. More...

virtual void ExitInstance ()
 Cleanup routine. More...

virtual bool Idle (int32)
virtual bool PretranslateI ()
 Called before a sys handler.

virtual bool PretranslateII ()
 Called before a menu handler.

virtual bool AppHandleEvent ()
 Called before a form handler (the last opportunity :).


Friends

class XPalmApp


Detailed Description

PalmApp class is a base class for the application. The application object should inhert from the PalmApp class. In a minimum implementation the application can be just a PalmApp object, though in most cases the setup and the exist routines are implemented.

Typical code in the PalmApp constructor is intialization of other forms objects, global objects or resources that are not PalmOS related.

The PalmApp object serves as a container for the application forms.

In order to link the application to the PalmOS and define the entry point use a set of macros. These macros define the entry point, an event handler and the exit code. A PalmApp object is instantiated in the macros and is used to start the application:

For example:

BEGIN_ENTRY_POINT(PalmOsApp)
    DEFAULT_C_STUB()
END_ENTRY_POINT(PalmOsApp)

The PalmOsApp class:

////////////////////////////////////////////////////////////////////////////////////////
// class PalmOsApp
// ----- ---------
class PalmOsApp : public ail::PalmApp
{
    private:
     MSExplorer Explorer;
     MSForm     MainForm;
    protected:
     void       InitInstance();
     void       ExitInstance();
    public:
     // ctor/dtor
                PalmOsApp();
               ~PalmOsApp();
};

Definition at line 76 of file PalmApp.hpp.


Member Function Documentation

void PalmApp::ExitInstance   [protected, virtual]
 

This method is executed before existing the application. Cleanup code that uses PalmOS services should be placed here and not in the destructor.

Definition at line 38 of file PalmApp.cpp.

void PalmApp::InitInstance   [protected, virtual]
 

Called when the application is first loaded. This is the place to put the initialization code for the app. This is a good place to verify the version of the Palm OS, or the type of the HW in order to tune the application.
This is the place to put PalmOS calls, do not make any PalmOS calls in the constructor.

Example for initialization code:

void PalmOsApp::InitInstance()
{
    if(!Explorer.IsCompatible())
    {
        NON_FATAL_ERROR("The device is not compatible")
        SetExitCode(PalmApp::eInitInstanceCode);
        return;
    }

    if(!MainForm.LoadForm())
    {
        SetExitCode(PalmApp::eInitInstanceCode);
        return;
    }
}

Definition at line 34 of file PalmApp.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jan 22 22:13:24 2002 for AIL by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001