]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/private/gsocketiohandler.h | |
3 | // Purpose: class for registering GSocket in wxSelectDispatcher | |
4 | // Authors: Lukasz Michalski | |
5 | // Created: December 2006 | |
6 | // Copyright: (c) Lukasz Michalski | |
7 | // RCS-ID: $Id$ | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_PRIVATE_GSOCKETIOHANDLER_H_ | |
12 | #define _WX_PRIVATE_GSOCKETIOHANDLER_H_ | |
13 | ||
14 | #include "wx/defs.h" | |
15 | ||
16 | #if wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER | |
17 | ||
18 | #include "wx/private/selectdispatcher.h" | |
19 | #include "wx/gsocket.h" | |
20 | ||
21 | class WXDLLIMPEXP_BASE wxGSocketIOHandler : public wxFDIOHandler | |
22 | { | |
23 | public: | |
24 | wxGSocketIOHandler(GSocket* socket) | |
25 | { | |
26 | m_socket = socket; | |
27 | m_flags = 0; | |
28 | } | |
29 | ||
30 | int GetFlags() const { return m_flags; } | |
31 | void RemoveFlag(wxFDIODispatcherEntryFlags flag) { m_flags &= ~flag; } | |
32 | void AddFlag(wxFDIODispatcherEntryFlags flag) { m_flags |= flag; } | |
33 | ||
34 | virtual void OnReadWaiting() { m_socket->Detected_Read(); } | |
35 | virtual void OnWriteWaiting() { m_socket->Detected_Write(); } | |
36 | virtual void OnExceptionWaiting() { m_socket->Detected_Read(); } | |
37 | ||
38 | private: | |
39 | GSocket* m_socket; | |
40 | int m_flags; | |
41 | }; | |
42 | ||
43 | #endif // wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER | |
44 | ||
45 | #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ |