]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/evtloop.h
Compile fix for VC++ 6
[wxWidgets.git] / include / wx / msw / evtloop.h
CommitLineData
3754265e
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/msw/evtloop.h
3// Purpose: wxEventLoop class for MSW
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
b46b1d59 15#if wxUSE_GUI
cafed236 16#include "wx/window.h"
b46b1d59 17#endif
cafed236 18
3754265e
VZ
19// ----------------------------------------------------------------------------
20// wxEventLoop
21// ----------------------------------------------------------------------------
22
b46b1d59 23class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual
3754265e
VZ
24{
25public:
b46b1d59 26 wxMSWEventLoopBase();
3754265e
VZ
27
28 // implement base class pure virtuals
3754265e 29 virtual bool Pending() const;
3754265e 30
b46b1d59
VZ
31protected:
32 // get the next message from queue and return true or return false if we
33 // got WM_QUIT or an error occurred
34 bool GetNextMessage(WXMSG *msg);
35};
36
37#if wxUSE_GUI
38
39class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxMSWEventLoopBase
40{
41public:
42 wxGUIEventLoop() { }
43
44 // process a single message: calls PreProcessMessage() before dispatching
45 // it
46 virtual void ProcessMessage(WXMSG *msg);
3754265e
VZ
47
48 // preprocess a message, return true if processed (i.e. no further
49 // dispatching required)
50 virtual bool PreProcessMessage(WXMSG *msg);
51
a7b7500c
VZ
52 // set the critical window: this is the window such that all the events
53 // except those to this window (and its children) stop to be processed
54 // (typical examples: assert or crash report dialog)
55 //
56 // calling this function with NULL argument restores the normal event
57 // handling
b4626104 58 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
a7b7500c
VZ
59
60 // return true if there is no critical window or if this window is [a child
61 // of] the critical one
b4626104 62 static bool AllowProcessing(wxWindowMSW *win)
a7b7500c
VZ
63 {
64 return !ms_winCritical || IsChildOfCriticalWindow(win);
65 }
66
b80e8ac9 67 // override/implement base class virtuals
b46b1d59 68 virtual bool Dispatch();
b80e8ac9 69 virtual void WakeUp();
b46b1d59
VZ
70
71protected:
b80e8ac9
VZ
72 virtual void OnNextIteration();
73
b46b1d59 74private:
a7b7500c
VZ
75 // check if the given window is a child of ms_winCritical (which must be
76 // non NULL)
b4626104 77 static bool IsChildOfCriticalWindow(wxWindowMSW *win);
a7b7500c
VZ
78
79
80 // critical window or NULL
b4626104 81 static wxWindowMSW *ms_winCritical;
3754265e
VZ
82};
83
b46b1d59
VZ
84#else // !wxUSE_GUI
85
61478ea0
VZ
86#if wxUSE_CONSOLE_EVENTLOOP
87
b46b1d59
VZ
88class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxMSWEventLoopBase
89{
90public:
91 wxConsoleEventLoop() { }
92
93 // override/implement base class virtuals
94 virtual bool Dispatch();
95 virtual void WakeUp();
96
97protected:
98 virtual void OnNextIteration();
99};
100
61478ea0
VZ
101#endif // wxUSE_CONSOLE_EVENTLOOP
102
b46b1d59
VZ
103#endif // wxUSE_GUI/!wxUSE_GUI
104
3754265e 105#endif // _WX_MSW_EVTLOOP_H_