-// ----------------------------------------------------------------------------
-// wxEventLoopImpl
-// ----------------------------------------------------------------------------
-
-class WXDLLEXPORT wxEventLoopImpl
-{
-public:
- // ctor
- wxEventLoopImpl() { m_exitcode = 0; m_shouldExit = false; }
-
- // process a message
- void ProcessMessage(MSG *msg);
-
- // generate an idle message, return TRUE if more idle time requested
- bool SendIdleMessage();
-
- // set/get the exit code
- void Exit(int exitcode) { m_exitcode = exitcode; m_shouldExit = true; }
- int GetExitCode() const { return m_exitcode; }
- bool ShouldExit() const { return m_shouldExit; }
-
- enum wxCatchAllResponse {
- catch_continue,
- catch_exit,
- catch_rethrow
- };
- wxCatchAllResponse OnCatchAll();
-
-private:
- // preprocess a message, return TRUE if processed (i.e. no further
- // dispatching required)
- bool PreProcessMessage(MSG *msg);
-
- // the exit code of the event loop
- int m_exitcode;
-
- // true if we were asked to terminate
- bool m_shouldExit;
-};
-
-// ----------------------------------------------------------------------------
-// helper class
-// ----------------------------------------------------------------------------
-
-wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopImpl);
-
-// this object sets the wxEventLoop given to the ctor as the currently active
-// one and unsets it in its dtor
-class wxEventLoopActivator
-{
-public:
- wxEventLoopActivator(wxEventLoop **pActive,
- wxEventLoop *evtLoop)
- {
- m_pActive = pActive;
- m_evtLoopOld = *pActive;
- *pActive = evtLoop;
- }
-
- ~wxEventLoopActivator()
- {
- // restore the previously active event loop
- *m_pActive = m_evtLoopOld;
- }
-
-private:
- wxEventLoop *m_evtLoopOld;
- wxEventLoop **m_pActive;
-};
-