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 <ScreenSaver.h> 16 #include <View.h> 17 #include <Window.h> 18 19 #include "ScreenSaverSettings.h" 20 21 22 class ScreenSaverRunner { 23 public: 24 ScreenSaverRunner(BWindow* window, 25 BView* view, 26 ScreenSaverSettings& settings); 27 ~ScreenSaverRunner(); 28 29 BScreenSaver* ScreenSaver() const { return fSaver; }; 30 31 status_t Run(); 32 void Quit(); 33 34 status_t Suspend(); 35 status_t Resume(); 36 37 private: 38 void _LoadAddOn(); 39 void _CleanUp(); 40 static status_t _ThreadFunc(void* data); 41 status_t _Run(); 42 43 BWindow* fWindow; 44 BView* fView; 45 bool fIsDirectDraw; 46 ScreenSaverSettings& fSettings; 47 48 BScreenSaver* fSaver; 49 50 image_id fAddonImage; 51 thread_id fThread; 52 volatile bool fQuitting; 53 }; 54 55 #endif // SCREEN_SAVER_RUNNER_H 56