| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: src/palmos/evtloop.cpp |
| 3 | // Purpose: implements wxGUIEventLoop 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 | // 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 | |
| 49 | #include <Event.h> |
| 50 | #include <SystemMgr.h> |
| 51 | #include <Menu.h> |
| 52 | #include <Form.h> |
| 53 | |
| 54 | // ============================================================================ |
| 55 | // wxGUIEventLoop implementation |
| 56 | // ============================================================================ |
| 57 | |
| 58 | // ---------------------------------------------------------------------------- |
| 59 | // ctor/dtor |
| 60 | // ---------------------------------------------------------------------------- |
| 61 | |
| 62 | wxGUIEventLoop::wxGUIEventLoop() |
| 63 | { |
| 64 | m_shouldExit = false; |
| 65 | m_exitcode = 0; |
| 66 | } |
| 67 | |
| 68 | // ---------------------------------------------------------------------------- |
| 69 | // wxGUIEventLoop message processing |
| 70 | // ---------------------------------------------------------------------------- |
| 71 | |
| 72 | void wxGUIEventLoop::ProcessMessage(WXMSG *msg) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | bool wxGUIEventLoop::PreProcessMessage(WXMSG *msg) |
| 77 | { |
| 78 | return false; |
| 79 | } |
| 80 | |
| 81 | // ---------------------------------------------------------------------------- |
| 82 | // wxGUIEventLoop running and exiting |
| 83 | // ---------------------------------------------------------------------------- |
| 84 | |
| 85 | bool wxGUIEventLoop::IsRunning() const |
| 86 | { |
| 87 | return true; |
| 88 | } |
| 89 | |
| 90 | int wxGUIEventLoop::Run() |
| 91 | { |
| 92 | status_t error; |
| 93 | EventType event; |
| 94 | |
| 95 | wxEventLoopActivator activate(this); |
| 96 | |
| 97 | do { |
| 98 | wxTheApp && wxTheApp->ProcessIdle(); |
| 99 | |
| 100 | EvtGetEvent(&event, evtWaitForever); |
| 101 | |
| 102 | if (SysHandleEvent(&event)) |
| 103 | continue; |
| 104 | |
| 105 | if (MenuHandleEvent(0, &event, &error)) |
| 106 | continue; |
| 107 | |
| 108 | FrmDispatchEvent(&event); |
| 109 | |
| 110 | } while (event.eType != appStopEvent); |
| 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | void wxGUIEventLoop::Exit(int rc) |
| 116 | { |
| 117 | FrmCloseAllForms(); |
| 118 | |
| 119 | EventType AppStop; |
| 120 | AppStop.eType=appStopEvent; |
| 121 | EvtAddEventToQueue(&AppStop); |
| 122 | } |
| 123 | |
| 124 | // ---------------------------------------------------------------------------- |
| 125 | // wxGUIEventLoop message processing dispatching |
| 126 | // ---------------------------------------------------------------------------- |
| 127 | |
| 128 | bool wxGUIEventLoop::Pending() const |
| 129 | { |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | bool wxGUIEventLoop::Dispatch() |
| 134 | { |
| 135 | return false; |
| 136 | } |
| 137 | |