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