| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/osx/evtloopsrc.h |
| 3 | // Purpose: wxCFEventLoopSource class |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Created: 2009-10-21 |
| 6 | // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org> |
| 7 | // Licence: wxWindows licence |
| 8 | /////////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #ifndef _WX_OSX_EVTLOOPSRC_H_ |
| 11 | #define _WX_OSX_EVTLOOPSRC_H_ |
| 12 | |
| 13 | typedef struct __CFSocket* CFSocketRef; |
| 14 | |
| 15 | // ---------------------------------------------------------------------------- |
| 16 | // wxCFEventLoopSource: CoreFoundation-based wxEventLoopSource for OS X |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | |
| 19 | class WXDLLIMPEXP_BASE wxCFEventLoopSource : public wxEventLoopSource |
| 20 | { |
| 21 | public: |
| 22 | // Create a new source in uninitialized state, call InitSocketRef() later |
| 23 | // to associate it with the socket it is going to use. |
| 24 | wxCFEventLoopSource(wxEventLoopSourceHandler *handler, int flags) |
| 25 | : wxEventLoopSource(handler, flags) |
| 26 | { |
| 27 | m_cfSocket = NULL; |
| 28 | } |
| 29 | |
| 30 | // Finish initialization of the event loop source by providing the |
| 31 | // associated socket. This object takes ownership of it and will release it. |
| 32 | void InitSourceSocket(CFSocketRef cfSocket); |
| 33 | |
| 34 | // Destructor deletes the associated socket. |
| 35 | virtual ~wxCFEventLoopSource(); |
| 36 | |
| 37 | private: |
| 38 | CFSocketRef m_cfSocket; |
| 39 | |
| 40 | wxDECLARE_NO_COPY_CLASS(wxCFEventLoopSource); |
| 41 | }; |
| 42 | |
| 43 | #endif // _WX_OSX_EVTLOOPSRC_H_ |
| 44 | |