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