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