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