]>
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 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/window.h"
32 #include "wx/evtloop.h"
34 #include "wx/tooltip.h"
35 #include "wx/except.h"
36 #include "wx/ptr_scpd.h"
39 #include "wx/thread.h"
41 // define the array of MSG strutures
42 WX_DECLARE_OBJARRAY(MSG
, wxMsgArray
);
44 #include "wx/arrimpl.cpp"
46 WX_DEFINE_OBJARRAY(wxMsgArray
);
47 #endif // wxUSE_THREADS
50 #include <SystemMgr.h>
54 // ----------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------
58 // this object sets the wxEventLoop given to the ctor as the currently active
59 // one and unsets it in its dtor
60 class wxEventLoopActivator
63 wxEventLoopActivator(wxEventLoop
**pActive
,
67 m_evtLoopOld
= *pActive
;
71 ~wxEventLoopActivator()
73 // restore the previously active event loop
74 *m_pActive
= m_evtLoopOld
;
78 wxEventLoop
*m_evtLoopOld
;
79 wxEventLoop
**m_pActive
;
82 // ============================================================================
83 // wxEventLoop implementation
84 // ============================================================================
86 wxEventLoop
*wxEventLoopBase::ms_activeLoop
= NULL
;
88 // ----------------------------------------------------------------------------
90 // ----------------------------------------------------------------------------
92 wxEventLoop::wxEventLoop()
98 // ----------------------------------------------------------------------------
99 // wxEventLoop message processing
100 // ----------------------------------------------------------------------------
102 void wxEventLoop::ProcessMessage(WXMSG
*msg
)
106 bool wxEventLoop::PreProcessMessage(WXMSG
*msg
)
111 // ----------------------------------------------------------------------------
112 // wxEventLoop running and exiting
113 // ----------------------------------------------------------------------------
115 bool wxEventLoop::IsRunning() const
120 int wxEventLoop::Run()
126 wxTheApp
&& wxTheApp
->ProcessIdle();
128 EvtGetEvent(&event
, evtWaitForever
);
130 if (SysHandleEvent(&event
))
133 if (MenuHandleEvent(0, &event
, &error
))
136 FrmDispatchEvent(&event
);
138 } while (event
.eType
!= appStopEvent
);
143 void wxEventLoop::Exit(int rc
)
148 AppStop
.eType
=appStopEvent
;
149 EvtAddEventToQueue(&AppStop
);
152 // ----------------------------------------------------------------------------
153 // wxEventLoop message processing dispatching
154 // ----------------------------------------------------------------------------
156 bool wxEventLoop::Pending() const
161 bool wxEventLoop::Dispatch()