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