xref: /haiku/headers/os/interface/OptionControl.h (revision bab64f65bb775dc23060e276f1f1c4498ab7af6c)
1 /*
2  * Copyright 2001-2015, 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_TOP,
22 									uint32 flags = B_WILL_DRAW);
23 								BOptionControl(const char* name,
24 									const char* label, BMessage* message,
25 									uint32 flags = B_WILL_DRAW);
26 
27 	virtual						~BOptionControl();
28 
29 	virtual	void				MessageReceived(BMessage* message);
30 
31 			status_t			AddOption(const char* name, int32 value);
32 	virtual	bool				GetOptionAt(int32 index, const char** _name,
33 									int32* _value) = 0;
34 	virtual	void				RemoveOptionAt(int32 index) = 0;
35 	virtual	int32				CountOptions() const = 0;
36 	virtual	status_t			AddOptionAt(const char* name, int32 value,
37 									int32 index) = 0;
38 	virtual	int32				SelectedOption(const char** name = NULL,
39 									int32* outValue = NULL) const = 0;
40 
41 	virtual	status_t			SelectOptionFor(int32 value);
42 	virtual	status_t			SelectOptionFor(const char* name);
43 
44 protected:
45 			BMessage*			MakeValueMessage(int32 value);
46 
47 private:
48 	// FBC padding and forbidden methods
49 								BOptionControl();
50 								BOptionControl(const BOptionControl& other);
51 			BOptionControl&		operator=(const BOptionControl& other);
52 
53 	virtual	status_t			_Reserved_OptionControl_0(void*, ...);
54 	virtual	status_t			_Reserved_OptionControl_1(void*, ...);
55 	virtual	status_t			_Reserved_OptionControl_2(void*, ...);
56 	virtual	status_t			_Reserved_OptionControl_3(void*, ...);
57 	virtual	status_t			_Reserved_OptionControl_4(void*, ...);
58 	virtual	status_t			_Reserved_OptionControl_5(void*, ...);
59 	virtual	status_t			_Reserved_OptionControl_6(void*, ...);
60 	virtual	status_t			_Reserved_OptionControl_7(void*, ...);
61 	virtual	status_t			_Reserved_OptionControl_8(void*, ...);
62 	virtual	status_t			_Reserved_OptionControl_9(void*, ...);
63 	virtual	status_t			_Reserved_OptionControl_10(void*, ...);
64 	virtual	status_t			_Reserved_OptionControl_11(void*, ...);
65 
66 private:
67 			uint32				_reserved[8];
68 };
69 
70 
71 #endif // _OPTION_CONTROL_H
72