+ virtual void Exit(int rc = 0) = 0;
+
+ // return true if any events are available
+ virtual bool Pending() const = 0;
+
+ // dispatch a single event, return false if we should exit from the loop
+ virtual bool Dispatch() = 0;
+
+ // return currently active (running) event loop, may be NULL
+ static wxEventLoopBase *GetActive() { return ms_activeLoop; }
+
+ // set currently active (running) event loop
+ static void SetActive(wxEventLoopBase* loop) { ms_activeLoop = loop; }
+
+ // is this event loop running now?
+ //
+ // notice that even if this event loop hasn't terminated yet but has just
+ // spawned a nested (e.g. modal) event loop, this would return false
+ bool IsRunning() const;
+
+ // 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() = 0;
+
+protected:
+ // this function should be called before the event loop terminates, whether
+ // this happens normally (because of Exit() call) or abnormally (because of
+ // an exception thrown from inside the loop)
+ virtual void OnExit() { }
+
+
+ // the pointer to currently active loop
+ static wxEventLoopBase *ms_activeLoop;
+
+ DECLARE_NO_COPY_CLASS(wxEventLoopBase)
+};
+
+#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXDFB__) || defined(__UNIX__)
+
+// this class can be used to implement a standard event loop logic using
+// Pending() and Dispatch()
+//
+// it also handles idle processing automatically
+class WXDLLIMPEXP_BASE wxEventLoopManual : public wxEventLoopBase
+{
+public:
+ wxEventLoopManual();
+
+ // 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