xref: /haiku/headers/os/interface/Picture.h (revision 7a74a5df454197933bc6e80a542102362ee98703)
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 	class Private;
39 private:
40 	// FBC padding and forbidden methods
41 	virtual	void				_ReservedPicture1();
42 	virtual	void				_ReservedPicture2();
43 	virtual	void				_ReservedPicture3();
44 
45 			BPicture&			operator=(const BPicture&);
46 
47 private:
48 	friend class BWindow;
49 	friend class BView;
50 	friend class BPrintJob;
51 	friend class Private;
52 
53 			void				_InitData();
54 			void				_DisposeData();
55 
56 			void				_ImportOldData(const void* data, int32 size);
57 
58 			void				SetToken(int32 token);
59 			int32				Token() const;
60 
61 			bool				_AssertLocalCopy();
62 			bool				_AssertOldLocalCopy();
63 			bool				_AssertServerCopy();
64 
65 			status_t			_Upload();
66 			status_t			_Download();
67 
68 	// Deprecated API
69 								BPicture(const void* data, int32 size);
70 			const void*			Data() const;
71 			int32				DataSize() const;
72 
73 			void				Usurp(BPicture* lameDuck);
74 			BPicture*			StepDown();
75 
76 private:
77 			int32				fToken;
78 			_BPictureExtent_*	fExtent;
79 			BPicture*			fUsurped;
80 
81 			uint32				_reserved[3];
82 };
83 
84 #endif // _PICTURE_H
85 
86