+// ----------------------------------------------------------------------------
+// wxEventLoopActivator: helper class for wxEventLoop implementations
+// ----------------------------------------------------------------------------
+
+// this object sets the wxEventLoop given to the ctor as the currently active
+// one and unsets it in its dtor, this is especially useful in presence of
+// exceptions but is more tidy even when we don't use them
+class wxEventLoopActivator
+{
+public:
+ wxEventLoopActivator(wxEventLoop *evtLoop)
+ {
+ m_evtLoopOld = wxEventLoop::GetActive();
+ wxEventLoop::SetActive(evtLoop);
+ }
+
+ ~wxEventLoopActivator()
+ {
+ // restore the previously active event loop
+ wxEventLoop::SetActive(m_evtLoopOld);
+ }
+
+private:
+ wxEventLoop *m_evtLoopOld;
+};
+