wxApp development for WXPM
[wxWidgets.git] / include / wx / os2 / app.h
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
26 // Force an exit from main loop
27 void WXDLLEXPORT wxExit(void);
28
29 // Yield to other apps/messages
30 bool WXDLLEXPORT wxYield(void);
31
32 // Represents the application. Derive OnInit and declare
33 // a new App object to start application
34 class WXDLLEXPORT wxApp : public wxAppBase
35 {
36 DECLARE_DYNAMIC_CLASS(wxApp)
37
38 public:
39 wxApp();
40 virtual ~wxApp();
41
42 virtual bool OnInitGui(void);
43
44 // override base class (pure) virtuals
45 virtual int MainLoop(void);
46 virtual void ExitMainLoop(void);
47 virtual bool Initialized(void);
48 virtual bool Pending(void) ;
49 virtual void Dispatch(void);
50
51 virtual wxIcon GetStdIcon(int which) const;
52
53 virtual void SetPrintMode(int mode) { m_nPrintMode = mode; }
54 virtual int GetPrintMode(void) const { return m_nPrintMode; }
55
56 // implementation only
57 void OnIdle(wxIdleEvent& rEvent);
58 void OnEndSession(wxCloseEvent& rEvent);
59 void OnQueryEndSession(wxCloseEvent& rEvent);
60
61 // Send idle event to all top-level windows.
62 // Returns TRUE if more idle time is requested.
63 bool SendIdleEvents(void);
64
65 // Send idle event to window and all subwindows
66 // Returns TRUE if more idle time is requested.
67 bool SendIdleEvents(wxWindow* pWin);
68
69 void SetAuto3D(bool bFlag) { m_bAuto3D = bFlag; }
70 bool GetAuto3D(void) const { return m_bAuto3D; }
71
72 protected:
73 bool m_bShowOnInit;
74 int m_nPrintMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
75 bool m_bAuto3D ; // Always use 3D controls, except where overriden
76
77 //
78 // PM-specific wxApp definitions */
79 //
80 public:
81
82 // Implementation
83 static bool Initialize(HAB vHab);
84 static void CleanUp(void);
85
86 static bool RegisterWindowClasses(HAB vHab);
87 virtual bool DoMessage(void);
88 virtual bool ProcessMessage(WXMSG* pMsg);
89 void DeletePendingObjects(void);
90 bool ProcessIdle(void);
91 #if wxUSE_THREADS
92 void ProcessPendingEvents(void);
93 #endif
94
95 public:
96 int m_nCmdShow;
97
98 protected:
99 bool m_bKeepGoing ;
100
101 DECLARE_EVENT_TABLE()
102 private:
103 HAB m_vHab;
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