xref: /haiku/headers/private/screen_saver/ScreenSaverRunner.h (revision 4b7e219688450694efc9d1890f83f816758c16d3)
1 /*
2  * Copyright 2003-2013 Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  *		Jérôme Duval, jerome.duval@free.fr
8  *		Michael Phipps
9  *		John Scipione, jscipione@gmail.com
10  */
11 #ifndef SCREEN_SAVER_RUNNER_H
12 #define SCREEN_SAVER_RUNNER_H
13 
14 
15 #include <SupportDefs.h>
16 #include <DirectWindow.h>
17 
18 
19 class BScreenSaver;
20 class BView;
21 class ScreenSaverSettings;
22 
23 
24 class ScreenSaverRunner {
25 public:
26 								ScreenSaverRunner(BWindow* window, BView* view,
27 									bool preview,
28 									ScreenSaverSettings& settings);
29 								~ScreenSaverRunner();
30 
31 			BScreenSaver*		ScreenSaver() const;
32 			bool				HasStarted() const;
33 
34 			status_t			Run();
35 			void				Quit();
36 
37 			void				Suspend();
38 			void				Resume();
39 
40 private:
41 			void				_LoadAddOn();
42 			void				_CleanUp();
43 	static	status_t			_ThreadFunc(void* data);
44 			status_t			_Run();
45 
46 			BScreenSaver*		fSaver;
47 			BWindow*			fWindow;
48 			BDirectWindow*		fDirectWindow;
49 			BView*				fView;
50 			ScreenSaverSettings& fSettings;
51 			bool				fPreview;
52 			bool				fHasStarted;
53 
54 			image_id			fAddonImage;
55 			thread_id			fThread;
56 			volatile bool		fQuitting;
57 };
58 
59 #endif // SCREEN_SAVER_RUNNER_H
60