1 /* 2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SCREENSAVER_H 6 #define _SCREENSAVER_H 7 8 9 #include <BeBuild.h> 10 #include <DirectWindow.h> 11 #include <image.h> 12 #include <Message.h> 13 14 class BView; 15 16 17 class BScreenSaver { 18 public: 19 BScreenSaver(BMessage* archive, image_id thisImage); 20 virtual ~BScreenSaver(); 21 22 virtual status_t InitCheck(); 23 24 virtual status_t StartSaver(BView* view, bool preview); 25 virtual void StopSaver(); 26 27 virtual void Draw(BView* view, int32 frame); 28 29 // direct screen access 30 virtual void DirectConnected(direct_buffer_info* info); 31 virtual void DirectDraw(int32 frame); 32 33 // configuration dialog methods 34 virtual void StartConfig(BView* configView); 35 virtual void StopConfig(); 36 37 // Module should fill this in with metadata 38 // example: randomizable = true 39 virtual void SupplyInfo(BMessage* info) const; 40 41 // Send all the metadata info to the module 42 virtual void ModulesChanged(const BMessage* info); 43 44 // BArchivable like parameter saver method 45 virtual status_t SaveState(BMessage* into) const; 46 47 // These methods can be used to control drawing frequency. 48 void SetTickSize(bigtime_t tickSize); 49 bigtime_t TickSize() const; 50 51 // These methods can be used to control animation loop cycles 52 void SetLoop(int32 onCount, int32 offCount); 53 int32 LoopOnCount() const; 54 int32 LoopOffCount() const; 55 56 private: 57 virtual void _ReservedScreenSaver1(); 58 virtual void _ReservedScreenSaver2(); 59 virtual void _ReservedScreenSaver3(); 60 virtual void _ReservedScreenSaver4(); 61 virtual void _ReservedScreenSaver5(); 62 virtual void _ReservedScreenSaver6(); 63 virtual void _ReservedScreenSaver7(); 64 virtual void _ReservedScreenSaver8(); 65 66 bigtime_t fTickSize; 67 int32 fLoopOnCount; 68 int32 fLoopOffCount; 69 70 uint32 _reserved[6]; 71 }; 72 73 extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id); 74 75 #endif // _SCREENSAVER_H 76