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