- // return true if we're running main loop, i.e. if the events can
- // (already) be dispatched
- static bool IsMainLoopRunning()
- {
-#if wxUSE_EVTLOOP_IN_APP
- wxAppBase *app = wx_static_cast(wxAppBase *, GetInstance());
- return app && app->m_mainLoop != NULL;
-#else
- return false;
-#endif
- }
-
- // execute the main GUI loop, the function returns when the loop ends
- virtual int MainLoop();
-
- // exit the main loop thus terminating the application
- virtual void Exit();
-
- // exit the main GUI loop during the next iteration (i.e. it does not
- // stop the program immediately!)
- virtual void ExitMainLoop();
-
- // returns true if there are unprocessed events in the event queue
- virtual bool Pending();
-
- // process the first event in the event queue (blocks until an event
- // appears if there are none currently, use Pending() if this is not
- // wanted), returns false if the event loop should stop and true
- // otherwise
- virtual bool Dispatch();
-
- // process all currently pending events right now
- //
- // it is an error to call Yield() recursively unless the value of
- // onlyIfNeeded is true
- //
- // WARNING: this function is dangerous as it can lead to unexpected
- // reentrancies (i.e. when called from an event handler it
- // may result in calling the same event handler again), use
- // with _extreme_ care or, better, don't use at all!
- virtual bool Yield(bool onlyIfNeeded = false) = 0;
+ // safer alternatives to Yield(), using wxWindowDisabler
+ virtual bool SafeYield(wxWindow *win, bool onlyIfNeeded);
+ virtual bool SafeYieldFor(wxWindow *win, long eventsToProcess);