1 /* 2 * Copyright 2001-2009, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * DarkWyrm <bpmagic@columbus.rr.com> 7 * Stefano Ceccherini <stefano.ceccherini@gmail.com> 8 */ 9 #ifndef SERVER_PICTURE_H 10 #define SERVER_PICTURE_H 11 12 13 #include <DataIO.h> 14 15 #include <ObjectList.h> 16 #include <PictureDataWriter.h> 17 #include <Referenceable.h> 18 19 20 class ServerApp; 21 class View; 22 class BFile; 23 24 namespace BPrivate { 25 class LinkReceiver; 26 class PortLink; 27 } 28 class BList; 29 30 31 class ServerPicture : public BReferenceable, public PictureDataWriter { 32 public: 33 ServerPicture(); 34 ServerPicture(const ServerPicture& other); 35 ServerPicture(const char* fileName, 36 int32 offset); 37 ~ServerPicture(); 38 39 int32 Token() { return fToken; } 40 bool SetOwner(ServerApp* owner); 41 42 bool ReleaseClientReference(); 43 44 void EnterStateChange(); 45 void ExitStateChange(); 46 47 void SyncState(View* view); 48 void SetFontFromLink(BPrivate::LinkReceiver& link); 49 50 void Play(View* view); 51 52 void Usurp(ServerPicture* newPicture); 53 ServerPicture* StepDown(); 54 55 bool NestPicture(ServerPicture* picture); 56 57 off_t DataLength() const; 58 59 status_t ImportData(BPrivate::LinkReceiver& link); 60 status_t ExportData(BPrivate::PortLink& link); 61 62 protected: 63 virtual void LastReferenceReleased(); 64 65 private: 66 typedef BObjectList<ServerPicture> PictureList; 67 68 int32 fToken; 69 BFile* fFile; 70 BPositionIO* fData; 71 PictureList* fPictures; 72 ServerPicture* fUsurped; 73 ServerApp* fOwner; 74 bool fHasClientReference; 75 }; 76 77 #endif // SERVER_PICTURE_H 78