xref: /haiku/headers/os/interface/Picture.h (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
1 /*
2  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef	_PICTURE_H
6 #define	_PICTURE_H
7 
8 
9 #include <InterfaceDefs.h>
10 #include <Rect.h>
11 #include <Archivable.h>
12 
13 
14 class BDataIO;
15 class BView;
16 struct _BPictureExtent_;
17 
18 
19 class BPicture : public BArchivable {
20 public:
21 								BPicture();
22 								BPicture(const BPicture& other);
23 								BPicture(BMessage* archive);
24 	virtual						~BPicture();
25 
26 	static	BArchivable*		Instantiate(BMessage* archive);
27 	virtual	status_t			Archive(BMessage* archive,
28 									bool deep = true) const;
29 	virtual	status_t			Perform(perform_code d, void* arg);
30 
31 			status_t			Play(void** callBackTable,
32 									int32 tableEntries,
33 									void* userData);
34 
35 			status_t			Flatten(BDataIO* stream);
36 			status_t			Unflatten(BDataIO* stream);
37 
38 private:
39 	// FBC padding and forbidden methods
40 	virtual	void				_ReservedPicture1();
41 	virtual	void				_ReservedPicture2();
42 	virtual	void				_ReservedPicture3();
43 
44 			BPicture&			operator=(const BPicture&);
45 
46 private:
47 	friend class BWindow;
48 	friend class BView;
49 	friend class BPrintJob;
50 
51 			void				_InitData();
52 			void				_DisposeData();
53 
54 			void				_ImportOldData(const void* data, int32 size);
55 
56 			void				SetToken(int32 token);
57 			int32				Token() const;
58 
59 			bool				_AssertLocalCopy();
60 			bool				_AssertOldLocalCopy();
61 			bool				_AssertServerCopy();
62 
63 			status_t			_Upload();
64 			status_t			_Download();
65 
66 	// Deprecated API
67 								BPicture(const void* data, int32 size);
68 			const void*			Data() const;
69 			int32				DataSize() const;
70 
71 			void				Usurp(BPicture* lameDuck);
72 			BPicture*			StepDown();
73 
74 
75 private:
76 			int32				fToken;
77 			_BPictureExtent_*	fExtent;
78 			BPicture*			fUsurped;
79 
80 			uint32				_reserved[3];
81 };
82 
83 #endif // _PICTURE_H
84 
85