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