+//////////////////////////////////////////////////////////////////////////////
+//
+// Keep trying to process messages until WM_QUIT
+// received.
+//
+// If there are messages to be processed, they will all be
+// processed and OnIdle will not be called.
+// When there are no more messages, OnIdle is called.
+// If OnIdle requests more time,
+// it will be repeatedly called so long as there are no pending messages.
+// A 'feature' of this is that once OnIdle has decided that no more processing
+// is required, then it won't get processing time until further messages
+// are processed (it'll sit in Dispatch).
+//
+//////////////////////////////////////////////////////////////////////////////
+class CallEventLoopMethod
+{
+public:
+ typedef void (wxEventLoop::*FuncType)();
+
+ CallEventLoopMethod(wxEventLoop *evtLoop, FuncType fn)
+ : m_evtLoop(evtLoop), m_fn(fn) { }
+ ~CallEventLoopMethod() { (m_evtLoop->*m_fn)(); }
+
+private:
+ wxEventLoop *m_evtLoop;
+ FuncType m_fn;
+};
+