| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: app.h |
| 3 | // Purpose: wxApp class |
| 4 | // Author: David Webster |
| 5 | // Modified by: |
| 6 | // Created: 10/13/99 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) David Webster |
| 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 WXDLLEXPORT wxFrame; |
| 19 | class WXDLLEXPORT wxWindow; |
| 20 | class WXDLLEXPORT wxApp ; |
| 21 | class WXDLLEXPORT wxKeyEvent; |
| 22 | class WXDLLEXPORT wxLog; |
| 23 | |
| 24 | WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; |
| 25 | WXDLLEXPORT_DATA(extern HAB) vHabmain; |
| 26 | |
| 27 | // Force an exit from main loop |
| 28 | void WXDLLEXPORT wxExit(void); |
| 29 | |
| 30 | // Yield to other apps/messages |
| 31 | bool WXDLLEXPORT wxYield(void); |
| 32 | |
| 33 | // Represents the application. Derive OnInit and declare |
| 34 | // a new App object to start application |
| 35 | class WXDLLEXPORT wxApp : public wxAppBase |
| 36 | { |
| 37 | DECLARE_DYNAMIC_CLASS(wxApp) |
| 38 | |
| 39 | public: |
| 40 | wxApp(); |
| 41 | virtual ~wxApp(); |
| 42 | |
| 43 | virtual bool OnInitGui(void); |
| 44 | |
| 45 | // override base class (pure) virtuals |
| 46 | virtual int MainLoop(void); |
| 47 | virtual void ExitMainLoop(void); |
| 48 | virtual bool Initialized(void); |
| 49 | virtual bool Pending(void) ; |
| 50 | virtual void Dispatch(void); |
| 51 | |
| 52 | virtual wxIcon GetStdIcon(int which) const; |
| 53 | |
| 54 | virtual void SetPrintMode(int mode) { m_nPrintMode = mode; } |
| 55 | virtual int GetPrintMode(void) const { return m_nPrintMode; } |
| 56 | |
| 57 | // implementation only |
| 58 | void OnIdle(wxIdleEvent& rEvent); |
| 59 | void OnEndSession(wxCloseEvent& rEvent); |
| 60 | void OnQueryEndSession(wxCloseEvent& rEvent); |
| 61 | |
| 62 | // Send idle event to all top-level windows. |
| 63 | // Returns TRUE if more idle time is requested. |
| 64 | bool SendIdleEvents(void); |
| 65 | |
| 66 | // Send idle event to window and all subwindows |
| 67 | // Returns TRUE if more idle time is requested. |
| 68 | bool SendIdleEvents(wxWindow* pWin); |
| 69 | |
| 70 | void SetAuto3D(bool bFlag) { m_bAuto3D = bFlag; } |
| 71 | bool GetAuto3D(void) const { return m_bAuto3D; } |
| 72 | |
| 73 | protected: |
| 74 | bool m_bShowOnInit; |
| 75 | int m_nPrintMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT |
| 76 | bool m_bAuto3D ; // Always use 3D controls, except where overriden |
| 77 | |
| 78 | // |
| 79 | // PM-specific wxApp definitions */ |
| 80 | // |
| 81 | public: |
| 82 | |
| 83 | // Implementation |
| 84 | static bool Initialize(HAB vHab); |
| 85 | static void CleanUp(void); |
| 86 | |
| 87 | static bool RegisterWindowClasses(HAB vHab); |
| 88 | virtual bool DoMessage(void); |
| 89 | virtual bool ProcessMessage(WXMSG* pMsg); |
| 90 | void DeletePendingObjects(void); |
| 91 | bool ProcessIdle(void); |
| 92 | #if wxUSE_THREADS |
| 93 | void ProcessPendingEvents(void); |
| 94 | #endif |
| 95 | |
| 96 | public: |
| 97 | int m_nCmdShow; |
| 98 | |
| 99 | protected: |
| 100 | bool m_bKeepGoing ; |
| 101 | |
| 102 | DECLARE_EVENT_TABLE() |
| 103 | private: |
| 104 | HMQ m_hMq; |
| 105 | QMSG m_vMsg; |
| 106 | }; |
| 107 | |
| 108 | int WXDLLEXPORT wxEntry( int argc, char *argv[] ); |
| 109 | #endif |
| 110 | // _WX_APP_H_ |
| 111 | |