X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffecfa5aeb540b54914739dbb8603edbbd4c00a0..3225a4b8b8656f25dac6cb20684a3c2c273cf796:/src/palmos/evtloop.cpp?ds=sidebyside diff --git a/src/palmos/evtloop.cpp b/src/palmos/evtloop.cpp index 36b0cf43db..6b15d3d2cd 100644 --- a/src/palmos/evtloop.cpp +++ b/src/palmos/evtloop.cpp @@ -1,12 +1,12 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: palmos/evtloop.cpp -// Purpose: implements wxEventLoop for Palm OS -// Author: William Osborne +// Name: src/palmos/evtloop.cpp +// Purpose: implements wxGUIEventLoop for Palm OS +// Author: William Osborne - minimal working wxPalmOS port // Modified by: // Created: 10.14.04 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) William Osborne -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "evtloop.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -37,7 +33,6 @@ #include "wx/tooltip.h" #include "wx/except.h" -#include "wx/ptr_scpd.h" #if wxUSE_THREADS #include "wx/thread.h" @@ -50,96 +45,73 @@ WX_DEFINE_OBJARRAY(wxMsgArray); #endif // wxUSE_THREADS -// ---------------------------------------------------------------------------- -// helper class -// ---------------------------------------------------------------------------- - -// 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; -}; +#include +#include +#include +#include // ============================================================================ -// wxEventLoop implementation +// wxGUIEventLoop implementation // ============================================================================ -wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL; - // ---------------------------------------------------------------------------- // ctor/dtor // ---------------------------------------------------------------------------- -wxEventLoop::wxEventLoop() +wxGUIEventLoop::wxGUIEventLoop() { m_shouldExit = false; m_exitcode = 0; } // ---------------------------------------------------------------------------- -// wxEventLoop message processing +// wxGUIEventLoop message processing // ---------------------------------------------------------------------------- -void wxEventLoop::ProcessMessage(WXMSG *msg) +void wxGUIEventLoop::ProcessMessage(WXMSG *msg) { } -bool wxEventLoop::PreProcessMessage(WXMSG *msg) +bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) { - return false; + return false; } // ---------------------------------------------------------------------------- -// wxEventLoop running and exiting +// wxGUIEventLoop running and exiting // ---------------------------------------------------------------------------- -bool wxEventLoop::IsRunning() const +bool wxGUIEventLoop::IsRunning() const { return true; } -int wxEventLoop::Run() +int wxGUIEventLoop::Run() { status_t error; EventType event; + wxEventLoopActivator activate(this); + do { wxTheApp && wxTheApp->ProcessIdle(); - + EvtGetEvent(&event, evtWaitForever); if (SysHandleEvent(&event)) continue; - + if (MenuHandleEvent(0, &event, &error)) continue; - + FrmDispatchEvent(&event); - } while (event.eType != appStopEvent); - + } while (event.eType != appStopEvent); + return 0; } -void wxEventLoop::Exit(int rc) +void wxGUIEventLoop::Exit(int rc) { FrmCloseAllForms(); @@ -149,16 +121,31 @@ void wxEventLoop::Exit(int rc) } // ---------------------------------------------------------------------------- -// wxEventLoop message processing dispatching +// wxGUIEventLoop message processing dispatching // ---------------------------------------------------------------------------- -bool wxEventLoop::Pending() const +bool wxGUIEventLoop::Pending() const { - return false; + return false; } -bool wxEventLoop::Dispatch() +bool wxGUIEventLoop::Dispatch() { return false; } +int wxGUIEventLoop::DispatchTimeout(unsigned long timeout) +{ + return -1; +} + +void wxGUIEventLoop::WakeUp() +{ + return; +} + +bool wxGUIEventLoop::YieldFor(long eventsToProcess) +{ + return true; +} +