]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/evtloop.h
Add wxPreferencesEditor class.
[wxWidgets.git] / include / wx / msw / evtloop.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/evtloop.h
3 // Purpose: wxEventLoop class for wxMSW port
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 2004-07-31
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003-2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_EVTLOOP_H_
13 #define _WX_MSW_EVTLOOP_H_
14
15 #include "wx/dynarray.h"
16 #include "wx/msw/wrapwin.h"
17 #include "wx/window.h"
18 #include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
19
20 // ----------------------------------------------------------------------------
21 // wxEventLoop
22 // ----------------------------------------------------------------------------
23
24 WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray);
25
26 class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
27 {
28 public:
29 wxGUIEventLoop() { }
30
31 // process a single message: calls PreProcessMessage() before dispatching
32 // it
33 virtual void ProcessMessage(WXMSG *msg);
34
35 // preprocess a message, return true if processed (i.e. no further
36 // dispatching required)
37 virtual bool PreProcessMessage(WXMSG *msg);
38
39 // set the critical window: this is the window such that all the events
40 // except those to this window (and its children) stop to be processed
41 // (typical examples: assert or crash report dialog)
42 //
43 // calling this function with NULL argument restores the normal event
44 // handling
45 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
46
47 // return true if there is no critical window or if this window is [a child
48 // of] the critical one
49 static bool AllowProcessing(wxWindowMSW *win)
50 {
51 return !ms_winCritical || IsChildOfCriticalWindow(win);
52 }
53
54 // override/implement base class virtuals
55 virtual bool Dispatch();
56 virtual int DispatchTimeout(unsigned long timeout);
57 virtual void WakeUp();
58 virtual bool YieldFor(long eventsToProcess);
59
60 protected:
61 virtual void OnNextIteration();
62
63 private:
64 // check if the given window is a child of ms_winCritical (which must be
65 // non NULL)
66 static bool IsChildOfCriticalWindow(wxWindowMSW *win);
67
68 // array of messages used for temporary storage by YieldFor()
69 wxMSGArray m_arrMSG;
70
71 // critical window or NULL
72 static wxWindowMSW *ms_winCritical;
73 };
74
75 #endif // _WX_MSW_EVTLOOP_H_