xref: /haiku/src/apps/icon-o-matic/generic/property/specific_properties/IconProperty.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2006, Haiku.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #ifndef ICON_PROPERTY_H
10 #define ICON_PROPERTY_H
11 
12 #include <GraphicsDefs.h>
13 
14 #include "Property.h"
15 
16 class IconProperty : public Property {
17  public:
18 								IconProperty(uint32 identifier,
19 											 const uchar* icon,
20 											 uint32 width, uint32 height,
21 											 color_space format,
22 											 BMessage* message = NULL);
23 								IconProperty(const IconProperty& other);
24 								IconProperty(BMessage* archive);
25 	virtual						~IconProperty();
26 
27 	// BArchivable interface
28 	virtual	status_t			Archive(BMessage* archive,
29 										bool deep = true) const;
30 	static	BArchivable*		Instantiate(BMessage* archive);
31 
32 	// Property interface
33 	virtual	Property*			Clone() const;
34 
35 	virtual	type_code			Type() const
36 									{ return B_RGB_COLOR_TYPE; }
37 
38 	virtual	bool				SetValue(const char* value);
39 	virtual	bool				SetValue(const Property* other);
40 	virtual	void				GetValue(BString& string);
41 
42 	virtual	bool				InterpolateTo(const Property* other,
43 											  float scale);
44 	// IconProperty
45 			BMessage*			Message() const
46 									{ return fMessage; }
47 
48 			void				SetMessage(const BMessage* message);
49 
50 			const uchar* 		Icon() const { return fIcon; }
51 			uint32 				Width() const { return fWidth; }
52 			uint32 				Height() const { return fHeight; }
53 			color_space 		Format() const { return fFormat; }
54  private:
55 			BMessage*			fMessage;
56 
57 			const uchar* 		fIcon;
58 			uint32				fWidth;
59 			uint32				fHeight;
60 			color_space			fFormat;
61 };
62 
63 
64 #endif // ICON_PROPERTY_H
65 
66 
67