]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/evtloop.cpp
really fix binary backwards compatibility for wxMotif
[wxWidgets.git] / 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
5 // Modified by:
6 // Created: 10.14.04
7 // RCS-ID: $Id$
8 // Copyright: (c) William Osborne
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "evtloop.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/window.h"
33 #include "wx/app.h"
34 #endif //WX_PRECOMP
35
36 #include "wx/evtloop.h"
37
38 #include "wx/tooltip.h"
39 #include "wx/except.h"
40 #include "wx/ptr_scpd.h"
41
42 #if wxUSE_THREADS
43 #include "wx/thread.h"
44
45 // define the array of MSG strutures
46 WX_DECLARE_OBJARRAY(MSG, wxMsgArray);
47
48 #include "wx/arrimpl.cpp"
49
50 WX_DEFINE_OBJARRAY(wxMsgArray);
51 #endif // wxUSE_THREADS
52
53 #include <Event.h>
54 #include <SystemMgr.h>
55 #include <Menu.h>
56 #include <Form.h>
57
58 // ----------------------------------------------------------------------------
59 // helper class
60 // ----------------------------------------------------------------------------
61
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
65 {
66 public:
67 wxEventLoopActivator(wxEventLoop **pActive,
68 wxEventLoop *evtLoop)
69 {
70 m_pActive = pActive;
71 m_evtLoopOld = *pActive;
72 *pActive = evtLoop;
73 }
74
75 ~wxEventLoopActivator()
76 {
77 // restore the previously active event loop
78 *m_pActive = m_evtLoopOld;
79 }
80
81 private:
82 wxEventLoop *m_evtLoopOld;
83 wxEventLoop **m_pActive;
84 };
85
86 // ============================================================================
87 // wxEventLoop implementation
88 // ============================================================================
89
90 wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
91
92 // ----------------------------------------------------------------------------
93 // ctor/dtor
94 // ----------------------------------------------------------------------------
95
96 wxEventLoop::wxEventLoop()
97 {
98 m_shouldExit = false;
99 m_exitcode = 0;
100 }
101
102 // ----------------------------------------------------------------------------
103 // wxEventLoop message processing
104 // ----------------------------------------------------------------------------
105
106 void wxEventLoop::ProcessMessage(WXMSG *msg)
107 {
108 }
109
110 bool wxEventLoop::PreProcessMessage(WXMSG *msg)
111 {
112 return false;
113 }
114
115 // ----------------------------------------------------------------------------
116 // wxEventLoop running and exiting
117 // ----------------------------------------------------------------------------
118
119 bool wxEventLoop::IsRunning() const
120 {
121 return true;
122 }
123
124 int wxEventLoop::Run()
125 {
126 status_t error;
127 EventType event;
128
129 do {
130 wxTheApp && wxTheApp->ProcessIdle();
131
132 EvtGetEvent(&event, evtWaitForever);
133
134 if (SysHandleEvent(&event))
135 continue;
136
137 if (MenuHandleEvent(0, &event, &error))
138 continue;
139
140 FrmDispatchEvent(&event);
141
142 } while (event.eType != appStopEvent);
143
144 return 0;
145 }
146
147 void wxEventLoop::Exit(int rc)
148 {
149 FrmCloseAllForms();
150
151 EventType AppStop;
152 AppStop.eType=appStopEvent;
153 EvtAddEventToQueue(&AppStop);
154 }
155
156 // ----------------------------------------------------------------------------
157 // wxEventLoop message processing dispatching
158 // ----------------------------------------------------------------------------
159
160 bool wxEventLoop::Pending() const
161 {
162 return false;
163 }
164
165 bool wxEventLoop::Dispatch()
166 {
167 return false;
168 }
169