xref: /haiku/headers/os/interface/OptionControl.h (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
1 /*
2  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _OPTION_CONTROL_H
6 #define _OPTION_CONTROL_H
7 
8 
9 #include <Control.h>
10 
11 
12 enum {
13 	B_OPTION_CONTROL_VALUE = '_BMV'
14 };
15 
16 
17 class BOptionControl : public BControl {
18 public:
19 								BOptionControl(BRect frame, const char* name,
20 									const char* label, BMessage* message,
21 									uint32 resizeMask = B_FOLLOW_LEFT
22 										| B_FOLLOW_TOP,
23 									uint32 flags = B_WILL_DRAW);
24 								BOptionControl(const char* name,
25 									const char* label, BMessage* message,
26 									uint32 flags = B_WILL_DRAW);
27 
28 	virtual						~BOptionControl();
29 
30 	virtual	void				MessageReceived(BMessage* message);
31 
32 			status_t			AddOption(const char* name, int32 value);
33 	virtual	bool				GetOptionAt(int32 index, const char** _name,
34 									int32* _value) = 0;
35 	virtual	void				RemoveOptionAt(int32 index) = 0;
36 	virtual	int32				CountOptions() const = 0;
37 	virtual	status_t			AddOptionAt(const char* name, int32 value,
38 									int32 index) = 0;
39 	virtual	int32				SelectedOption(const char** name = NULL,
40 									int32* outValue = NULL) const = 0;
41 
42 	virtual	status_t			SelectOptionFor(int32 value);
43 	virtual	status_t			SelectOptionFor(const char* name);
44 
45 protected:
46 			BMessage*			MakeValueMessage(int32 value);
47 
48 private:
49 	// FBC padding and forbidden methods
50 								BOptionControl();
51 								BOptionControl(const BOptionControl& other);
52 			BOptionControl&		operator=(const BOptionControl& other);
53 
54 	virtual	status_t			_Reserved_OptionControl_0(void*, ...);
55 	virtual	status_t			_Reserved_OptionControl_1(void*, ...);
56 	virtual	status_t			_Reserved_OptionControl_2(void*, ...);
57 	virtual	status_t			_Reserved_OptionControl_3(void*, ...);
58 	virtual	status_t			_Reserved_OptionControl_4(void*, ...);
59 	virtual	status_t			_Reserved_OptionControl_5(void*, ...);
60 	virtual	status_t			_Reserved_OptionControl_6(void*, ...);
61 	virtual	status_t			_Reserved_OptionControl_7(void*, ...);
62 	virtual	status_t			_Reserved_OptionControl_8(void*, ...);
63 	virtual	status_t			_Reserved_OptionControl_9(void*, ...);
64 	virtual	status_t			_Reserved_OptionControl_10(void*, ...);
65 	virtual	status_t			_Reserved_OptionControl_11(void*, ...);
66 
67 private:
68 			uint32				_reserved[8];
69 };
70 
71 
72 #endif // _OPTION_CONTROL_H
73