xref: /haiku/src/servers/app/ServerPicture.h (revision 239222b2369c39dc52df52b0a7cdd6cc0a91bc92)
1 /*
2  * Copyright 2001-2009, 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 			void				EnterStateChange();
43 			void				ExitStateChange();
44 
45 			void				SyncState(View* view);
46 			void				SetFontFromLink(BPrivate::LinkReceiver& link);
47 
48 			void				Play(View* view);
49 
50 			void 				Usurp(ServerPicture* newPicture);
51 			ServerPicture*		StepDown();
52 
53 			bool				NestPicture(ServerPicture* picture);
54 
55 			off_t				DataLength() const;
56 
57 			status_t			ImportData(BPrivate::LinkReceiver& link);
58 			status_t			ExportData(BPrivate::PortLink& link);
59 
60 protected:
61 	virtual	void				LastReferenceReleased();
62 
63 private:
64 	typedef BObjectList<ServerPicture> PictureList;
65 
66 			int32				fToken;
67 			BFile*				fFile;
68 			BPositionIO*		fData;
69 			PictureList*		fPictures;
70 			ServerPicture*		fUsurped;
71 			ServerApp*			fOwner;
72 };
73 
74 #endif	// SERVER_PICTURE_H
75