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