]>
git.saurik.com Git - wxWidgets.git/blob - src/palmos/evtloop.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/evtloop.cpp
3 // Purpose: implements wxEventLoop for Palm OS
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "evtloop.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/window.h"
36 #include "wx/evtloop.h"
38 #include "wx/tooltip.h"
39 #include "wx/except.h"
40 #include "wx/ptr_scpd.h"
43 #include "wx/thread.h"
45 // define the array of MSG strutures
46 WX_DECLARE_OBJARRAY(MSG
, wxMsgArray
);
48 #include "wx/arrimpl.cpp"
50 WX_DEFINE_OBJARRAY(wxMsgArray
);
51 #endif // wxUSE_THREADS
54 #include <SystemMgr.h>
58 // ----------------------------------------------------------------------------
60 // ----------------------------------------------------------------------------
62 // this object sets the wxEventLoop given to the ctor as the currently active
63 // one and unsets it in its dtor
64 class wxEventLoopActivator
67 wxEventLoopActivator(wxEventLoop
**pActive
,
71 m_evtLoopOld
= *pActive
;
75 ~wxEventLoopActivator()
77 // restore the previously active event loop
78 *m_pActive
= m_evtLoopOld
;
82 wxEventLoop
*m_evtLoopOld
;
83 wxEventLoop
**m_pActive
;
86 // ============================================================================
87 // wxEventLoop implementation
88 // ============================================================================
90 wxEventLoop
*wxEventLoopBase::ms_activeLoop
= NULL
;
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 wxEventLoop::wxEventLoop()
102 // ----------------------------------------------------------------------------
103 // wxEventLoop message processing
104 // ----------------------------------------------------------------------------
106 void wxEventLoop::ProcessMessage(WXMSG
*msg
)
110 bool wxEventLoop::PreProcessMessage(WXMSG
*msg
)
115 // ----------------------------------------------------------------------------
116 // wxEventLoop running and exiting
117 // ----------------------------------------------------------------------------
119 bool wxEventLoop::IsRunning() const
124 int wxEventLoop::Run()
130 wxTheApp
&& wxTheApp
->ProcessIdle();
132 EvtGetEvent(&event
, evtWaitForever
);
134 if (SysHandleEvent(&event
))
137 if (MenuHandleEvent(0, &event
, &error
))
140 FrmDispatchEvent(&event
);
142 } while (event
.eType
!= appStopEvent
);
147 void wxEventLoop::Exit(int rc
)
152 AppStop
.eType
=appStopEvent
;
153 EvtAddEventToQueue(&AppStop
);
156 // ----------------------------------------------------------------------------
157 // wxEventLoop message processing dispatching
158 // ----------------------------------------------------------------------------
160 bool wxEventLoop::Pending() const
165 bool wxEventLoop::Dispatch()