]> git.saurik.com Git - wxWidgets.git/blame - 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
CommitLineData
3754265e
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/evtloop.h
e27f5540 3// Purpose: wxEventLoop class for wxMSW port
3754265e
VZ
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 2004-07-31
3754265e
VZ
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
8bd9fa33
FM
14#include "wx/dynarray.h"
15#include "wx/msw/wrapwin.h"
cafed236 16#include "wx/window.h"
e27f5540 17#include "wx/msw/evtloopconsole.h" // for wxMSWEventLoopBase
cafed236 18
3754265e
VZ
19// ----------------------------------------------------------------------------
20// wxEventLoop
21// ----------------------------------------------------------------------------
22
22cb3139 23WX_DECLARE_EXPORTED_OBJARRAY(MSG, wxMSGArray);
dde19c21 24
b46b1d59
VZ
25class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
26{
27public:
28 wxGUIEventLoop() { }
29
30 // process a single message: calls PreProcessMessage() before dispatching
31 // it
32 virtual void ProcessMessage(WXMSG *msg);
3754265e
VZ
33
34 // preprocess a message, return true if processed (i.e. no further
35 // dispatching required)
36 virtual bool PreProcessMessage(WXMSG *msg);
37
a7b7500c
VZ
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
b4626104 44 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
a7b7500c
VZ
45
46 // return true if there is no critical window or if this window is [a child
47 // of] the critical one
b4626104 48 static bool AllowProcessing(wxWindowMSW *win)
a7b7500c
VZ
49 {
50 return !ms_winCritical || IsChildOfCriticalWindow(win);
51 }
52
b80e8ac9 53 // override/implement base class virtuals
b46b1d59 54 virtual bool Dispatch();
9af42efd 55 virtual int DispatchTimeout(unsigned long timeout);
b80e8ac9 56 virtual void WakeUp();
dde19c21 57 virtual bool YieldFor(long eventsToProcess);
b46b1d59
VZ
58
59protected:
b80e8ac9
VZ
60 virtual void OnNextIteration();
61
b46b1d59 62private:
a7b7500c
VZ
63 // check if the given window is a child of ms_winCritical (which must be
64 // non NULL)
b4626104 65 static bool IsChildOfCriticalWindow(wxWindowMSW *win);
a7b7500c 66
dde19c21
FM
67 // array of messages used for temporary storage by YieldFor()
68 wxMSGArray m_arrMSG;
a7b7500c
VZ
69
70 // critical window or NULL
b4626104 71 static wxWindowMSW *ms_winCritical;
3754265e
VZ
72};
73
74#endif // _WX_MSW_EVTLOOP_H_