]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/evtloop.cpp
further resized icons to 16*15 (still patch 1151163)
[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 // ----------------------------------------------------------------------------
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
59 class wxEventLoopActivator
60 {
61 public:
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
76 private:
77 wxEventLoop *m_evtLoopOld;
78 wxEventLoop **m_pActive;
79 };
80
81 // ============================================================================
82 // wxEventLoop implementation
83 // ============================================================================
84
85 wxEventLoop *wxEventLoopBase::ms_activeLoop = NULL;
86
87 // ----------------------------------------------------------------------------
88 // ctor/dtor
89 // ----------------------------------------------------------------------------
90
91 wxEventLoop::wxEventLoop()
92 {
93 m_shouldExit = false;
94 m_exitcode = 0;
95 }
96
97 // ----------------------------------------------------------------------------
98 // wxEventLoop message processing
99 // ----------------------------------------------------------------------------
100
101 void wxEventLoop::ProcessMessage(WXMSG *msg)
102 {
103 }
104
105 bool wxEventLoop::PreProcessMessage(WXMSG *msg)
106 {
107 return false;
108 }
109
110 // ----------------------------------------------------------------------------
111 // wxEventLoop running and exiting
112 // ----------------------------------------------------------------------------
113
114 bool wxEventLoop::IsRunning() const
115 {
116 return true;
117 }
118
119 int wxEventLoop::Run()
120 {
121 status_t error;
122 EventType event;
123
124 do {
125 wxTheApp && wxTheApp->ProcessIdle();
126
127 EvtGetEvent(&event, evtWaitForever);
128
129 if (SysHandleEvent(&event))
130 continue;
131
132 if (MenuHandleEvent(0, &event, &error))
133 continue;
134
135 FrmDispatchEvent(&event);
136
137 } while (event.eType != appStopEvent);
138
139 return 0;
140 }
141
142 void 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
155 bool wxEventLoop::Pending() const
156 {
157 return false;
158 }
159
160 bool wxEventLoop::Dispatch()
161 {
162 return false;
163 }
164