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