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 OPTION_PROPERTY_H
10#define OPTION_PROPERTY_H
11
12#include <List.h>
13#include <String.h>
14
15#include "Property.h"
16
17class OptionProperty : public Property {
18 public:
19								OptionProperty(uint32 identifier);
20								OptionProperty(const OptionProperty& other);
21								OptionProperty(BMessage* archive);
22	virtual						~OptionProperty();
23
24	// Property interface
25	virtual	status_t			Archive(BMessage* archive,
26										bool deep = true) const;
27	static	BArchivable*		Instantiate(BMessage* archive);
28
29	virtual	Property*			Clone() const;
30
31	virtual	type_code			Type() const;
32
33	virtual	bool				SetValue(const char* value);
34	virtual	bool				SetValue(const Property* other);
35	virtual	void				GetValue(BString& string);
36
37	// animation
38	virtual	bool				MakeAnimatable(bool animatable = true);
39
40
41	// OptionProperty
42			void				AddOption(int32 id, const char* name);
43
44			int32				CurrentOptionID() const;
45			bool				SetCurrentOptionID(int32 id);
46
47			bool				GetOption(int32 index, BString* string, int32* id) const;
48			bool				GetCurrentOption(BString* string) const;
49
50			bool				SetOptionAtOffset(int32 indexOffset);
51
52 private:
53
54	struct option {
55		int32		id;
56		BString		name;
57	};
58
59			BList				fOptions;
60			int32				fCurrentOptionID;
61};
62
63
64#endif // OPTION_PROPERTY_H
65
66
67