1 /* 2 * Copyright 2001-2010, 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 ServerApp* Owner() const { return fOwner; } 42 43 bool ReleaseClientReference(); 44 45 void EnterStateChange(); 46 void ExitStateChange(); 47 48 void SyncState(View* view); 49 void SetFontFromLink(BPrivate::LinkReceiver& link); 50 51 void Play(View* view); 52 53 void PushPicture(ServerPicture* picture); 54 ServerPicture* PopPicture(); 55 56 void AppendPicture(ServerPicture* picture); 57 bool NestPicture(ServerPicture* picture); 58 59 off_t DataLength() const; 60 61 status_t ImportData(BPrivate::LinkReceiver& link); 62 status_t ExportData(BPrivate::PortLink& link); 63 64 private: 65 typedef BObjectList<ServerPicture> PictureList; 66 67 int32 fToken; 68 BFile* fFile; 69 BPositionIO* fData; 70 PictureList* fPictures; 71 ServerPicture* fPushed; 72 ServerApp* fOwner; 73 }; 74 75 76 #endif // SERVER_PICTURE_H 77