evtloopsrc.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef _WX_OSX_EVTLOOPSRC_H_
  10. #define _WX_OSX_EVTLOOPSRC_H_
  11. typedef struct __CFSocket* CFSocketRef;
  12. // ----------------------------------------------------------------------------
  13. // wxCFEventLoopSource: CoreFoundation-based wxEventLoopSource for OS X
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_BASE wxCFEventLoopSource : public wxEventLoopSource
  16. {
  17. public:
  18. // Create a new source in uninitialized state, call InitSocketRef() later
  19. // to associate it with the socket it is going to use.
  20. wxCFEventLoopSource(wxEventLoopSourceHandler *handler, int flags)
  21. : wxEventLoopSource(handler, flags)
  22. {
  23. m_cfSocket = NULL;
  24. }
  25. // Finish initialization of the event loop source by providing the
  26. // associated socket. This object takes ownership of it and will release it.
  27. void InitSourceSocket(CFSocketRef cfSocket);
  28. // Destructor deletes the associated socket.
  29. virtual ~wxCFEventLoopSource();
  30. private:
  31. CFSocketRef m_cfSocket;
  32. wxDECLARE_NO_COPY_CLASS(wxCFEventLoopSource);
  33. };
  34. #endif // _WX_OSX_EVTLOOPSRC_H_