xref: /haiku/headers/os/interface/Picture.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2001-2014 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* data);
24 	virtual						~BPicture();
25 
26 	static	BArchivable*		Instantiate(BMessage* data);
27 	virtual	status_t			Archive(BMessage* data, bool deep = true) const;
28 	virtual	status_t			Perform(perform_code code, void* arg);
29 
30 			status_t			Play(void** callBackTable,
31 									int32 tableEntries,
32 									void* userData);
33 
34 			status_t			Flatten(BDataIO* stream);
35 			status_t			Unflatten(BDataIO* stream);
36 
37 	class Private;
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 	friend class Private;
51 
52 			void				_InitData();
53 			void				_DisposeData();
54 
55 			void				_ImportOldData(const void* data, int32 size);
56 
57 			void				SetToken(int32 token);
58 			int32				Token() const;
59 
60 			bool				_AssertLocalCopy();
61 			bool				_AssertOldLocalCopy();
62 			bool				_AssertServerCopy();
63 
64 			status_t			_Upload();
65 			status_t			_Download();
66 
67 	// Deprecated API
68 								BPicture(const void* data, int32 size);
69 			const void*			Data() const;
70 			int32				DataSize() const;
71 
72 			void				Usurp(BPicture* lameDuck);
73 			BPicture*			StepDown();
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