X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0056673c672ab444863c57344936c9a322124df6..9015d579c839cb0676c75446d3b6bffd0623e970:/include/wx/osx/evtloop.h diff --git a/include/wx/osx/evtloop.h b/include/wx/osx/evtloop.h index 5ddb819d55..45b411e903 100644 --- a/include/wx/osx/evtloop.h +++ b/include/wx/osx/evtloop.h @@ -13,7 +13,8 @@ #ifndef _WX_OSX_EVTLOOP_H_ #define _WX_OSX_EVTLOOP_H_ -typedef struct __CFRunLoop * CFRunLoopRef; +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoop ); +DECLARE_WXOSX_OPAQUE_CFREF( CFRunLoopObserver ); class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopBase { @@ -28,7 +29,7 @@ public: // sets the "should exit" flag and wakes up the loop so that it terminates // soon virtual void Exit(int rc = 0); - + // return true if any events are available virtual bool Pending() const; @@ -51,20 +52,30 @@ public: AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags); #endif // wxUSE_EVENTLOOP_SOURCE + void ObserverCallBack(CFRunLoopObserverRef observer, int activity); + protected: // get the currently executing CFRunLoop virtual CFRunLoopRef CFGetCurrentRunLoop() const; virtual int DoDispatchTimeout(unsigned long timeout); + + virtual void DoRun(); - double m_sleepTime; - + virtual void DoStop(); + // should we exit the loop? bool m_shouldExit; // the loop exit code int m_exitcode; - + + // cfrunloop + CFRunLoopRef m_runLoop; + + // runloop observer + CFRunLoopObserverRef m_runLoopObserver; + private: // process all already pending events and dispatch a new one (blocking // until it appears in the event queue if necessary) @@ -74,11 +85,32 @@ private: }; #if wxUSE_GUI - #ifdef __WXOSX_COCOA__ - #include "wx/osx/cocoa/evtloop.h" - #else - #include "wx/osx/carbon/evtloop.h" - #endif + +#ifdef __WXOSX_COCOA__ + #include "wx/osx/cocoa/evtloop.h" +#else + #include "wx/osx/carbon/evtloop.h" +#endif + +class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxNonOwnedWindow; + +class WXDLLIMPEXP_CORE wxModalEventLoop : public wxGUIEventLoop +{ +public: + wxModalEventLoop(wxWindow *modalWindow); + wxModalEventLoop(WXWindow modalNativeWindow); + +protected: + virtual void DoRun(); + + virtual void DoStop(); + + // (in case) the modal window for this event loop + wxNonOwnedWindow* m_modalWindow; + WXWindow m_modalNativeWindow; +}; + #endif // wxUSE_GUI #endif // _WX_OSX_EVTLOOP_H_