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 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 PushPicture(ServerPicture* picture); 53 ServerPicture* PopPicture(); 54 55 void AppendPicture(ServerPicture* picture); 56 bool NestPicture(ServerPicture* picture); 57 58 off_t DataLength() const; 59 60 status_t ImportData(BPrivate::LinkReceiver& link); 61 status_t ExportData(BPrivate::PortLink& link); 62 63 private: 64 typedef BObjectList<ServerPicture> PictureList; 65 66 int32 fToken; 67 BFile* fFile; 68 BPositionIO* fData; 69 PictureList* fPictures; 70 ServerPicture* fPushed; 71 ServerApp* fOwner; 72 }; 73 74 75 #endif // SERVER_PICTURE_H 76