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 BFile; 21 class DrawingContext; 22 class ServerApp; 23 class View; 24 25 namespace BPrivate { 26 class LinkReceiver; 27 class PortLink; 28 } 29 class BList; 30 31 32 class ServerPicture : public BReferenceable, public PictureDataWriter { 33 public: 34 ServerPicture(); 35 ServerPicture(const ServerPicture& other); 36 ServerPicture(const char* fileName, 37 int32 offset); 38 ~ServerPicture(); 39 40 int32 Token() { return fToken; } 41 bool SetOwner(ServerApp* owner); 42 ServerApp* Owner() const { return fOwner; } 43 44 bool ReleaseClientReference(); 45 46 void EnterStateChange(); 47 void ExitStateChange(); 48 49 void SyncState(View* view); 50 void SetFontFromLink(BPrivate::LinkReceiver& link); 51 52 void Play(DrawingContext* target); 53 54 void PushPicture(ServerPicture* picture); 55 ServerPicture* PopPicture(); 56 57 void AppendPicture(ServerPicture* picture); 58 bool NestPicture(ServerPicture* picture); 59 60 off_t DataLength() const; 61 62 status_t ImportData(BPrivate::LinkReceiver& link); 63 status_t ExportData(BPrivate::PortLink& link); 64 65 private: 66 typedef BObjectList<ServerPicture> PictureList; 67 68 int32 fToken; 69 BFile* fFile; 70 BPositionIO* fData; 71 PictureList* fPictures; 72 ServerPicture* fPushed; 73 ServerApp* fOwner; 74 }; 75 76 77 #endif // SERVER_PICTURE_H 78