1 /* 2 * Copyright 2001-2015, 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 * Julian Harnath <julian.harnath@rwth-aachen.de> 9 */ 10 #ifndef SERVER_PICTURE_H 11 #define SERVER_PICTURE_H 12 13 14 #include <DataIO.h> 15 16 #include <ObjectList.h> 17 #include <PictureDataWriter.h> 18 #include <Referenceable.h> 19 20 21 class BFile; 22 class Canvas; 23 class ServerApp; 24 class View; 25 26 namespace BPrivate { 27 class LinkReceiver; 28 class PortLink; 29 } 30 class BList; 31 32 33 class ServerPicture : public BReferenceable, public PictureDataWriter { 34 public: 35 ServerPicture(); 36 ServerPicture(const ServerPicture& other); 37 ServerPicture(const char* fileName, 38 int32 offset); 39 virtual ~ServerPicture(); 40 41 int32 Token() { return fToken; } 42 bool SetOwner(ServerApp* owner); 43 ServerApp* Owner() const { return fOwner; } 44 45 bool ReleaseClientReference(); 46 47 void EnterStateChange(); 48 void ExitStateChange(); 49 50 void SyncState(View* view); 51 void SetFontFromLink(BPrivate::LinkReceiver& link); 52 53 void Play(Canvas* target); 54 55 void PushPicture(ServerPicture* picture); 56 ServerPicture* PopPicture(); 57 58 void AppendPicture(ServerPicture* picture); 59 bool NestPicture(ServerPicture* picture); 60 61 off_t DataLength() const; 62 63 status_t ImportData(BPrivate::LinkReceiver& link); 64 status_t ExportData(BPrivate::PortLink& link); 65 66 private: 67 friend class PictureBoundingBoxPlayer; 68 69 typedef BObjectList<ServerPicture> PictureList; 70 71 int32 fToken; 72 BFile* fFile; 73 BPositionIO* fData; 74 PictureList* fPictures; 75 ServerPicture* fPushed; 76 ServerApp* fOwner; 77 }; 78 79 80 #endif // SERVER_PICTURE_H 81