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