streamlining OSX event support first step, see #11805, see #11797

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2010-03-15 15:40:47 +00:00
parent be7e10393a
commit 0056673c67
7 changed files with 298 additions and 301 deletions

View File

@@ -15,9 +15,37 @@
typedef struct __CFRunLoop * CFRunLoopRef;
class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopManual
class WXDLLIMPEXP_BASE wxCFEventLoop : public wxEventLoopBase
{
public:
wxCFEventLoop();
virtual ~wxCFEventLoop();
// enters a loop calling OnNextIteration(), Pending() and Dispatch() and
// terminating when Exit() is called
virtual int Run();
// 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;
// dispatch a single event, return false if we should exit from the loop
virtual bool Dispatch();
// same as Dispatch() but doesn't wait for longer than the specified (in
// ms) timeout, return true if an event was processed, false if we should
// exit the loop or -1 if timeout expired
virtual int DispatchTimeout(unsigned long timeout);
// implement this to wake up the loop: usually done by posting a dummy event
// to it (can be called from non main thread)
virtual void WakeUp();
virtual bool YieldFor(long eventsToProcess);
#if wxUSE_EVENTLOOP_SOURCE
virtual wxEventLoopSource *
AddSourceForFD(int fd, wxEventLoopSourceHandler *handler, int flags);
@@ -25,7 +53,24 @@ public:
protected:
// get the currently executing CFRunLoop
virtual CFRunLoopRef CFGetCurrentRunLoop() const = 0;
virtual CFRunLoopRef CFGetCurrentRunLoop() const;
virtual int DoDispatchTimeout(unsigned long timeout);
double m_sleepTime;
// should we exit the loop?
bool m_shouldExit;
// the loop exit code
int m_exitcode;
private:
// process all already pending events and dispatch a new one (blocking
// until it appears in the event queue if necessary)
//
// returns the return value of DoDispatchTimeout()
int DoProcessEvents();
};
#if wxUSE_GUI