| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/palmos/app.h |
| 3 | // Purpose: wxApp class |
| 4 | // Author: William Osborne - minimal working wxPalmOS port |
| 5 | // Modified by: |
| 6 | // Created: 10/17/04 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) William Osborne |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_APP_H_ |
| 13 | #define _WX_APP_H_ |
| 14 | |
| 15 | #include "wx/event.h" |
| 16 | #include "wx/icon.h" |
| 17 | |
| 18 | class WXDLLIMPEXP_FWD_CORE wxFrame; |
| 19 | class WXDLLIMPEXP_FWD_CORE wxWindow; |
| 20 | class WXDLLIMPEXP_FWD_CORE wxApp; |
| 21 | class WXDLLIMPEXP_FWD_CORE wxKeyEvent; |
| 22 | class WXDLLIMPEXP_FWD_BASE wxLog; |
| 23 | |
| 24 | // Represents the application. Derive OnInit and declare |
| 25 | // a new App object to start application |
| 26 | class WXDLLIMPEXP_CORE wxApp : public wxAppBase |
| 27 | { |
| 28 | DECLARE_DYNAMIC_CLASS(wxApp) |
| 29 | |
| 30 | public: |
| 31 | wxApp(); |
| 32 | virtual ~wxApp(); |
| 33 | |
| 34 | // override base class (pure) virtuals |
| 35 | virtual bool Initialize(int& argc, wxChar **argv); |
| 36 | virtual void CleanUp(); |
| 37 | |
| 38 | virtual void WakeUpIdle(); |
| 39 | |
| 40 | virtual void SetPrintMode(int mode) { m_printMode = mode; } |
| 41 | virtual int GetPrintMode() const { return m_printMode; } |
| 42 | |
| 43 | // implementation only |
| 44 | void OnEndSession(wxCloseEvent& event); |
| 45 | void OnQueryEndSession(wxCloseEvent& event); |
| 46 | |
| 47 | #if wxUSE_EXCEPTIONS |
| 48 | virtual bool OnExceptionInMainLoop(); |
| 49 | #endif // wxUSE_EXCEPTIONS |
| 50 | |
| 51 | protected: |
| 52 | int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT |
| 53 | |
| 54 | public: |
| 55 | // Implementation |
| 56 | static bool RegisterWindowClasses(); |
| 57 | static bool UnregisterWindowClasses(); |
| 58 | |
| 59 | #if wxUSE_RICHEDIT |
| 60 | // initialize the richedit DLL of (at least) given version, return true if |
| 61 | // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) |
| 62 | static bool InitRichEdit(int version = 2); |
| 63 | #endif // wxUSE_RICHEDIT |
| 64 | |
| 65 | // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it |
| 66 | // wasn't found at all |
| 67 | static int GetComCtl32Version(); |
| 68 | |
| 69 | // the SW_XXX value to be used for the frames opened by the application |
| 70 | // (currently seems unused which is a bug -- TODO) |
| 71 | static int m_nCmdShow; |
| 72 | |
| 73 | protected: |
| 74 | DECLARE_EVENT_TABLE() |
| 75 | wxDECLARE_NO_COPY_CLASS(wxApp); |
| 76 | }; |
| 77 | |
| 78 | // ---------------------------------------------------------------------------- |
| 79 | // Palm OS specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition |
| 80 | // ---------------------------------------------------------------------------- |
| 81 | |
| 82 | #ifndef SW_SHOWNORMAL |
| 83 | #define SW_SHOWNORMAL 1 |
| 84 | #endif |
| 85 | |
| 86 | extern WXDLLIMPEXP_CORE int wxEntry(); |
| 87 | |
| 88 | #define IMPLEMENT_WXWIN_MAIN \ |
| 89 | \ |
| 90 | extern "C" { \ |
| 91 | \ |
| 92 | uint32_t PilotMain(uint16_t cmd, MemPtr cmdPBP, uint16_t launchFlags) \ |
| 93 | { \ |
| 94 | switch (cmd) { \ |
| 95 | case 0 /* sysAppLaunchCmdNormalLaunch */ : \ |
| 96 | wxEntry(); \ |
| 97 | break; \ |
| 98 | default: \ |
| 99 | break; \ |
| 100 | } \ |
| 101 | return 0 /* errNone */ ; \ |
| 102 | } \ |
| 103 | \ |
| 104 | } |
| 105 | |
| 106 | #endif // _WX_APP_H_ |
| 107 | |