1/*****************************************************************************/ 2// SlideShowSaver 3// Written by Michael Wilber 4// Slide show code derived from ShowImage code, written by Michael Pfeiffer 5// 6// SlideShowSaver.h 7// 8// 9// Copyright (C) Haiku 10// 11// Permission is hereby granted, free of charge, to any person obtaining a 12// copy of this software and associated documentation files (the "Software"), 13// to deal in the Software without restriction, including without limitation 14// the rights to use, copy, modify, merge, publish, distribute, sublicense, 15// and/or sell copies of the Software, and to permit persons to whom the 16// Software is furnished to do so, subject to the following conditions: 17// 18// The above copyright notice and this permission notice shall be included 19// in all copies or substantial portions of the Software. 20// 21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27// DEALINGS IN THE SOFTWARE. 28/*****************************************************************************/ 29 30 31#ifndef SLIDE_SHOW_SAVER_H 32#define SLIDE_SHOW_SAVER_H 33 34#include <Locker.h> 35#include <ScreenSaver.h> 36#include <Bitmap.h> 37#include <String.h> 38#include <Entry.h> 39#include "LiveSettings.h" 40 41class SlideShowSaver : 42 public BScreenSaver, 43 public LiveSettingsObserver { 44public: 45 SlideShowSaver(BMessage *archive, image_id image); 46 virtual ~SlideShowSaver(void); 47 48 virtual void SettingChanged(uint32 setting); 49 50 virtual void StartConfig(BView *view); 51 virtual status_t StartSaver(BView *view, bool preview); 52 virtual void Draw(BView *view, int32 frame); 53 54protected: 55 // reload ticksize setting and apply it 56 status_t UpdateTickSize(); 57 58 status_t UpdateShowCaption(); 59 status_t UpdateShowBorder(); 60 // reload directory setting and apply it 61 status_t UpdateDirectory(); 62 63 // Function taken from Haiku ShowImage, 64 // function originally written by Michael Pfeiffer 65 status_t SetImage(const entry_ref *pref); 66 67 // Function originally from Haiku ShowImage 68 bool ShowNextImage(bool next, bool rewind); 69 70 // Function taken from Haiku ShowImage, 71 // function originally written by Michael Pfeiffer 72 bool IsImage(const entry_ref *pref); 73 74 // Function taken from Haiku ShowImage, 75 // function originally written by Michael Pfeiffer 76 bool FindNextImage(entry_ref *in_current, entry_ref *out_image, bool next, bool rewind); 77 78 // Function taken from Haiku ShowImage, 79 // function originally written by Michael Pfeiffer 80 void FreeEntries(BList *entries); 81 82 void LayoutCaption(BView *view, BFont &font, BPoint &pos, BRect &rect); 83 void DrawCaption(BView *view); 84 // void UpdateCaption(BView *view); 85 86private: 87 BLocker fLock; 88 bool fNewDirectory; 89 LiveSettings *fSettings; 90 BBitmap *fBitmap; 91 BString fCaption; 92 entry_ref fCurrentRef; 93 bool fShowCaption; 94 bool fShowBorder; 95}; 96 97#endif // #ifndef SLIDE_SHOW_SAVER_H 98 99