xref: /haiku/headers/os/interface/OptionControl.h (revision 39241fe22890fb958b6ba32d6ab9526da98be187)
1 /*******************************************************************************
2 /
3 /	File:			OptionControl.h
4 /
5 /   Description:   A BOptionControl is an abstract interface for BControls that select
6 /	between a set of named values; the names are displayed to the user, but the
7 /	corresponding values are returned in Value().
8 /
9 /	Copyright 1997-99, Be Incorporated, All Rights Reserved
10 /
11 *******************************************************************************/
12 
13 #if !defined(_OPTION_CONTROL_H)
14 #define _OPTION_CONTROL_H
15 
16 #include <InterfaceDefs.h>
17 #include <Control.h>
18 
19 enum {
20 	B_OPTION_CONTROL_VALUE = '_BMV'
21 };
22 
23 
24 class BOptionControl :
25 	public BControl
26 {
27 public:
28 
29 							BOptionControl(
30 									BRect frame,
31 									const char * name,
32 									const char * label,
33 									BMessage * message,
34 									uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
35 									uint32 flags = B_WILL_DRAW);
36 virtual						~BOptionControl();
37 
38 virtual	void				MessageReceived(
39 									BMessage * message);
40 
41 		status_t			AddOption(
42 									const char * name,
43 									int32 value);
44 virtual	bool				GetOptionAt(
45 									int32 index,
46 									const char ** out_name,
47 									int32 * out_value) = 0;
48 virtual	void				RemoveOptionAt(
49 									int32 index) = 0;
50 virtual	int32				CountOptions() const = 0;
51 virtual	status_t			AddOptionAt(
52 									const char * name,
53 									int32 value,
54 									int32 index) = 0;
55 virtual	int32				SelectedOption(		//	index >= 0 returned directly
56 									const char ** name = 0,
57 									int32 * value = 0) const = 0;
58 
59 virtual	status_t			SelectOptionFor(
60 									int32 value);
61 virtual	status_t			SelectOptionFor(
62 									const char *name);
63 protected:
64 
65 		BMessage *			MakeValueMessage(
66 									int32 value);
67 
68 private:
69 
70 		BOptionControl();	/* private unimplemented */
71 		BOptionControl(
72 				const BOptionControl & clone);
73 		BOptionControl & operator=(
74 				const BOptionControl & clone);
75 
76 		/* Mmmh, stuffing! */
77 virtual		status_t _Reserved_OptionControl_0(void *, ...);
78 virtual		status_t _Reserved_OptionControl_1(void *, ...);
79 virtual		status_t _Reserved_OptionControl_2(void *, ...);
80 virtual		status_t _Reserved_OptionControl_3(void *, ...);
81 virtual		status_t _Reserved_OptionControl_4(void *, ...);
82 virtual		status_t _Reserved_OptionControl_5(void *, ...);
83 virtual		status_t _Reserved_OptionControl_6(void *, ...);
84 virtual		status_t _Reserved_OptionControl_7(void *, ...);
85 virtual		status_t _Reserved_OptionControl_8(void *, ...);
86 virtual		status_t _Reserved_OptionControl_9(void *, ...);
87 virtual		status_t _Reserved_OptionControl_10(void *, ...);
88 virtual		status_t _Reserved_OptionControl_11(void *, ...);
89 
90 		uint32 _reserved_selection_control_[8];
91 
92 };
93 
94 
95 #endif	/* _OPTION_CONTROL_H */
96