xref: /haiku/src/bin/screen_blanker/ScreenSaverWindow.h (revision aa4b5749d64af0c0573513c27296af16f4680367)
1 /*
2  * Copyright 2003, Michael Phipps. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef SCREEN_SAVER_WINDOW_H
6 #define SCREEN_SAVER_WINDOW_H
7 
8 
9 #include "ScreenSaver.h"
10 
11 #include <DirectWindow.h>
12 #include <MessageFilter.h>
13 
14 #include "ScreenSaverRunner.h"
15 
16 
17 const static uint32 kMsgEnableFilter = 'eflt';
18 
19 
20 class ScreenSaverFilter : public BMessageFilter {
21 public:
22 								ScreenSaverFilter()
23 								:
24 								BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
25 									fEnabled(true) {}
26 
27 	virtual	filter_result		Filter(BMessage* message, BHandler** target);
28 
29 			void				SetEnabled(bool enabled)
30 									{ fEnabled = enabled; };
31 
32 private:
33 			bool				fEnabled;
34 };
35 
36 
37 class ScreenSaverWindow : public BDirectWindow {
38 public:
39 								ScreenSaverWindow(BRect frame);
40 								~ScreenSaverWindow();
41 
42 	virtual	void				MessageReceived(BMessage* message);
43 	virtual	bool				QuitRequested();
44 	virtual	void				DirectConnected(direct_buffer_info* info);
45 
46 			void				SetSaverRunner(ScreenSaverRunner* runner);
47 			BScreenSaver*		_ScreenSaver();
48 
49 private:
50 			BView*				fTopView;
51 			ScreenSaverRunner*	fSaverRunner;
52 			ScreenSaverFilter*	fFilter;
53 };
54 
55 
56 #endif	// SCREEN_SAVER_WINDOW_H
57