]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/evtloop.cpp
wxSYS_COLOUR_WINDOW is better for window backgrounds on PPC/Smartphone
[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
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// ----------------------------------------------------------------------------
54// helper class
55// ----------------------------------------------------------------------------
56
57// this object sets the wxEventLoop given to the ctor as the currently active
58// one and unsets it in its dtor
59class wxEventLoopActivator
60{
61public:
62 wxEventLoopActivator(wxEventLoop **pActive,
63 wxEventLoop *evtLoop)
64 {
65 m_pActive = pActive;
66 m_evtLoopOld = *pActive;
67 *pActive = evtLoop;
68 }
69
70 ~wxEventLoopActivator()
71 {
72 // restore the previously active event loop
73 *m_pActive = m_evtLoopOld;
74 }
75
76private:
77 wxEventLoop *m_evtLoopOld;
78 wxEventLoop **m_pActive;
79};
80
81// ============================================================================
82// wxEventLoop implementation
83// ============================================================================
84
85wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
86
87// ----------------------------------------------------------------------------
88// ctor/dtor
89// ----------------------------------------------------------------------------
90
91wxEventLoop::wxEventLoop()
92{
93 m_shouldExit = false;
94 m_exitcode = 0;
95}
96
97// ----------------------------------------------------------------------------
98// wxEventLoop message processing
99// ----------------------------------------------------------------------------
100
101void wxEventLoop::ProcessMessage(WXMSG *msg)
102{
103}
104
105bool wxEventLoop::PreProcessMessage(WXMSG *msg)
106{
e2731512 107 return false;
ffecfa5a
JS
108}
109
110// ----------------------------------------------------------------------------
111// wxEventLoop running and exiting
112// ----------------------------------------------------------------------------
113
114bool wxEventLoop::IsRunning() const
115{
116 return true;
117}
118
119int wxEventLoop::Run()
120{
121 status_t error;
122 EventType event;
123
124 do {
125 wxTheApp && wxTheApp->ProcessIdle();
e2731512 126
ffecfa5a
JS
127 EvtGetEvent(&event, evtWaitForever);
128
129 if (SysHandleEvent(&event))
130 continue;
e2731512 131
ffecfa5a
JS
132 if (MenuHandleEvent(0, &event, &error))
133 continue;
e2731512 134
ffecfa5a
JS
135 FrmDispatchEvent(&event);
136
e2731512
WS
137 } while (event.eType != appStopEvent);
138
ffecfa5a
JS
139 return 0;
140}
141
142void wxEventLoop::Exit(int rc)
143{
144 FrmCloseAllForms();
145
146 EventType AppStop;
147 AppStop.eType=appStopEvent;
148 EvtAddEventToQueue(&AppStop);
149}
150
151// ----------------------------------------------------------------------------
152// wxEventLoop message processing dispatching
153// ----------------------------------------------------------------------------
154
155bool wxEventLoop::Pending() const
156{
e2731512 157 return false;
ffecfa5a
JS
158}
159
160bool wxEventLoop::Dispatch()
161{
162 return false;
163}
164