]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: app.h | |
3 | // Purpose: wxApp class | |
d88de032 | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
d88de032 | 6 | // Created: 10/13/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
d88de032 | 8 | // Copyright: (c) David Webster |
0e320a79 DW |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_APP_H_ | |
13 | #define _WX_APP_H_ | |
14 | ||
19193a2c KB |
15 | #ifdef __WATCOMC__ |
16 | ||
17 | #include <sys/ioctl.h> | |
18 | #include <sys/select.h> | |
19 | ||
20 | #else | |
21 | ||
3958ae62 SN |
22 | #include <sys/time.h> |
23 | #include <sys/types.h> | |
29108552 DW |
24 | |
25 | #ifdef __EMX__ | |
3958ae62 | 26 | #include <unistd.h> |
29108552 DW |
27 | #else |
28 | #include <utils.h> | |
29 | #undef BYTE_ORDER | |
30 | #include <types.h> | |
29108552 DW |
31 | #define INCL_ORDERS |
32 | #endif | |
3958ae62 | 33 | |
19193a2c KB |
34 | #endif |
35 | ||
0e320a79 | 36 | #include "wx/event.h" |
d88de032 | 37 | #include "wx/icon.h" |
0e320a79 DW |
38 | |
39 | class WXDLLEXPORT wxFrame; | |
40 | class WXDLLEXPORT wxWindow; | |
3958ae62 | 41 | class WXDLLEXPORT wxApp; |
0e320a79 DW |
42 | class WXDLLEXPORT wxKeyEvent; |
43 | class WXDLLEXPORT wxLog; | |
44 | ||
0e320a79 | 45 | WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; |
43543d98 | 46 | WXDLLEXPORT_DATA(extern HAB) vHabmain; |
0e320a79 DW |
47 | |
48 | // Force an exit from main loop | |
9ed0fac8 | 49 | void WXDLLEXPORT wxExit(void); |
0e320a79 DW |
50 | |
51 | // Yield to other apps/messages | |
9ed0fac8 | 52 | bool WXDLLEXPORT wxYield(void); |
0e320a79 | 53 | |
8c5907ce DW |
54 | extern MRESULT EXPENTRY wxWndProc( HWND |
55 | ,ULONG | |
56 | ,MPARAM | |
57 | ,MPARAM | |
58 | ); | |
59 | ||
3958ae62 | 60 | |
0e320a79 DW |
61 | // Represents the application. Derive OnInit and declare |
62 | // a new App object to start application | |
d88de032 | 63 | class WXDLLEXPORT wxApp : public wxAppBase |
0e320a79 | 64 | { |
d88de032 | 65 | DECLARE_DYNAMIC_CLASS(wxApp) |
0e320a79 | 66 | |
d88de032 DW |
67 | public: |
68 | wxApp(); | |
69 | virtual ~wxApp(); | |
0e320a79 | 70 | |
9ed0fac8 DW |
71 | virtual bool OnInitGui(void); |
72 | ||
d88de032 | 73 | // override base class (pure) virtuals |
9ed0fac8 DW |
74 | virtual int MainLoop(void); |
75 | virtual void ExitMainLoop(void); | |
76 | virtual bool Initialized(void); | |
77 | virtual bool Pending(void) ; | |
78 | virtual void Dispatch(void); | |
e2478fde VZ |
79 | |
80 | virtual void Exit(); | |
81 | ||
8461e4c2 | 82 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
e2478fde VZ |
83 | virtual bool ProcessIdle(void); |
84 | virtual void WakeUpIdle(void); | |
0e320a79 | 85 | |
9ed0fac8 DW |
86 | virtual void SetPrintMode(int mode) { m_nPrintMode = mode; } |
87 | virtual int GetPrintMode(void) const { return m_nPrintMode; } | |
0e320a79 | 88 | |
d88de032 | 89 | // implementation only |
9ed0fac8 DW |
90 | void OnIdle(wxIdleEvent& rEvent); |
91 | void OnEndSession(wxCloseEvent& rEvent); | |
92 | void OnQueryEndSession(wxCloseEvent& rEvent); | |
0e320a79 | 93 | |
d88de032 DW |
94 | // Send idle event to all top-level windows. |
95 | // Returns TRUE if more idle time is requested. | |
9ed0fac8 | 96 | bool SendIdleEvents(void); |
0e320a79 | 97 | |
d88de032 DW |
98 | // Send idle event to window and all subwindows |
99 | // Returns TRUE if more idle time is requested. | |
9ed0fac8 | 100 | bool SendIdleEvents(wxWindow* pWin); |
0e320a79 | 101 | |
9ed0fac8 DW |
102 | void SetAuto3D(bool bFlag) { m_bAuto3D = bFlag; } |
103 | bool GetAuto3D(void) const { return m_bAuto3D; } | |
0e320a79 | 104 | |
3958ae62 SN |
105 | int AddSocketHandler(int handle, int mask, |
106 | void (*callback)(void*), void * gsock); | |
107 | void RemoveSocketHandler(int handle); | |
108 | void HandleSockets(); | |
109 | ||
0e320a79 | 110 | protected: |
9ed0fac8 DW |
111 | bool m_bShowOnInit; |
112 | int m_nPrintMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT | |
113 | bool m_bAuto3D ; // Always use 3D controls, except where overriden | |
0e320a79 | 114 | |
9ed0fac8 DW |
115 | // |
116 | // PM-specific wxApp definitions */ | |
117 | // | |
3958ae62 | 118 | private: |
29108552 DW |
119 | int m_maxSocketHandles; |
120 | int m_maxSocketNr; | |
121 | int m_lastUsedHandle; | |
122 | fd_set m_readfds; | |
123 | fd_set m_writefds; | |
124 | void* m_sockCallbackInfo; | |
3958ae62 | 125 | |
d88de032 | 126 | public: |
0e320a79 | 127 | |
d88de032 | 128 | // Implementation |
05e2b077 | 129 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 | 130 | virtual void CleanUp(void); |
d88de032 | 131 | |
9ed0fac8 | 132 | static bool RegisterWindowClasses(HAB vHab); |
153b1416 | 133 | virtual void DoMessage(WXMSG *pMsg); |
9ed0fac8 | 134 | virtual bool DoMessage(void); |
d88de032 | 135 | virtual bool ProcessMessage(WXMSG* pMsg); |
0e320a79 DW |
136 | |
137 | public: | |
9ed0fac8 | 138 | int m_nCmdShow; |
3958ae62 | 139 | HMQ m_hMq; |
0e320a79 DW |
140 | |
141 | protected: | |
9ed0fac8 | 142 | bool m_bKeepGoing ; |
0e320a79 | 143 | |
d88de032 | 144 | DECLARE_EVENT_TABLE() |
0e320a79 DW |
145 | }; |
146 | ||
9ed0fac8 | 147 | int WXDLLEXPORT wxEntry( int argc, char *argv[] ); |
0e320a79 DW |
148 | #endif |
149 | // _WX_APP_H_ | |
150 |