]> git.saurik.com Git - wxWidgets.git/blob - include/wx/private/fdiohandler.h
Implement monitoring of file descriptors in wxMotif event loop.
[wxWidgets.git] / include / wx / private / fdiohandler.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/fdiohandler.h
3 // Purpose: declares wxFDIOHandler class
4 // Author: Vadim Zeitlin
5 // Created: 2009-08-17
6 // RCS-ID: $Id$
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PRIVATE_FDIOHANDLER_H_
12 #define _WX_PRIVATE_FDIOHANDLER_H_
13
14 // ----------------------------------------------------------------------------
15 // wxFDIOHandler: interface used to process events on file descriptors
16 // ----------------------------------------------------------------------------
17
18 class wxFDIOHandler
19 {
20 public:
21 wxFDIOHandler() { m_regmask = 0; }
22
23 // called when descriptor is available for non-blocking read
24 virtual void OnReadWaiting() = 0;
25
26 // called when descriptor is available for non-blocking write
27 virtual void OnWriteWaiting() = 0;
28
29 // called when there is exception on descriptor
30 virtual void OnExceptionWaiting() = 0;
31
32 // called to check if the handler is still valid, only used by
33 // wxSocketImplUnix currently
34 virtual bool IsOk() const { return true; }
35
36
37 // get/set the mask of events for which we're currently registered for:
38 // it's a combination of wxFDIO_{INPUT,OUTPUT,EXCEPTION}
39 int GetRegisteredEvents() const { return m_regmask; }
40 void SetRegisteredEvent(int flag) { m_regmask |= flag; }
41 void ClearRegisteredEvent(int flag) { m_regmask &= ~flag; }
42
43
44 // virtual dtor for the base class
45 virtual ~wxFDIOHandler() { }
46
47 private:
48 int m_regmask;
49
50 wxDECLARE_NO_COPY_CLASS(wxFDIOHandler);
51 };
52
53 #endif // _WX_PRIVATE_FDIOHANDLER_H_
54