]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/evtloop.h
added wxNotificationMessage and implemented it generically and natively for Maemo
[wxWidgets.git] / include / wx / msw / evtloop.h
... / ...
CommitLineData
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
15#if wxUSE_GUI
16#include "wx/window.h"
17#endif
18
19// ----------------------------------------------------------------------------
20// wxEventLoop
21// ----------------------------------------------------------------------------
22
23class WXDLLIMPEXP_BASE wxMSWEventLoopBase : public wxEventLoopManual
24{
25public:
26 wxMSWEventLoopBase();
27
28 // implement base class pure virtuals
29 virtual bool Pending() const;
30
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);
47
48 // preprocess a message, return true if processed (i.e. no further
49 // dispatching required)
50 virtual bool PreProcessMessage(WXMSG *msg);
51
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
58 static void SetCriticalWindow(wxWindowMSW *win) { ms_winCritical = win; }
59
60 // return true if there is no critical window or if this window is [a child
61 // of] the critical one
62 static bool AllowProcessing(wxWindowMSW *win)
63 {
64 return !ms_winCritical || IsChildOfCriticalWindow(win);
65 }
66
67 // override/implement base class virtuals
68 virtual bool Dispatch();
69 virtual void WakeUp();
70
71protected:
72 virtual void OnNextIteration();
73
74private:
75 // check if the given window is a child of ms_winCritical (which must be
76 // non NULL)
77 static bool IsChildOfCriticalWindow(wxWindowMSW *win);
78
79
80 // critical window or NULL
81 static wxWindowMSW *ms_winCritical;
82};
83
84#else // !wxUSE_GUI
85
86#if wxUSE_CONSOLE_EVENTLOOP
87
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
101#endif // wxUSE_CONSOLE_EVENTLOOP
102
103#endif // wxUSE_GUI/!wxUSE_GUI
104
105#endif // _WX_MSW_EVTLOOP_H_