1 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
2  *
3  * This is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This software is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this software; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
16  * USA.
17  */
18 
19 // -=- WMNotifier.h
20 //
21 // The WMNotifier is used to get callbacks indicating changes in the state
22 // of the system, for instance in the size/format/palette of the display.
23 // The WMNotifier contains a Win32 window, which receives notifications of
24 // system events and stores them.  Whenever processEvent is called, any
25 // incoming events are processed and the appropriate notifier called.
26 
27 #ifndef __RFB_WIN32_NOTIFIER_H__
28 #define __RFB_WIN32_NOTIFIER_H__
29 
30 #include <rfb/SDesktop.h>
31 #include <rfb_win32/MsgWindow.h>
32 #include <rfb_win32/DeviceFrameBuffer.h>
33 #include <rfb_win32/SInput.h>
34 
35 namespace rfb {
36 
37   namespace win32 {
38 
39     // -=- Window Message Monitor implementation
40 
41     class WMMonitor : MsgWindow {
42     public:
43 
44       class Notifier {
45       public:
46         typedef enum {DisplaySizeChanged,
47           DisplayPixelFormatChanged} DisplayEventType;
48         virtual void notifyDisplayEvent(DisplayEventType evt) = 0;
49       };
50 
51       WMMonitor();
52       virtual ~WMMonitor();
53 
setNotifier(Notifier * wmn)54       void setNotifier(Notifier* wmn) {notifier=wmn;}
55 
56     protected:
57       // - Internal MsgWindow callback
58       virtual LRESULT processMessage(UINT msg, WPARAM wParam, LPARAM lParam);
59 
60       Notifier* notifier;
61     };
62 
63   };
64 
65 };
66 
67 #endif // __RFB_WIN32_WMNOTIFIER_H__
68