xref: /haiku/headers/os/interface/OptionControl.h (revision bab64f65bb775dc23060e276f1f1c4498ab7af6c)
13c5bd344SStefano Ceccherini /*
2*7f9368caSlooncraz  * Copyright 2001-2015, Haiku, Inc. All rights reserved.
389208c77SStephan Aßmus  * Distributed under the terms of the MIT License.
43c5bd344SStefano Ceccherini  */
53c5bd344SStefano Ceccherini #ifndef _OPTION_CONTROL_H
6d734a8ceSbeveloper #define _OPTION_CONTROL_H
7d734a8ceSbeveloper 
856f7fdc4SStephan Aßmus 
9d734a8ceSbeveloper #include <Control.h>
10d734a8ceSbeveloper 
1156f7fdc4SStephan Aßmus 
12d734a8ceSbeveloper enum {
13d734a8ceSbeveloper 	B_OPTION_CONTROL_VALUE = '_BMV'
14d734a8ceSbeveloper };
15d734a8ceSbeveloper 
16d734a8ceSbeveloper 
173c5bd344SStefano Ceccherini class BOptionControl : public BControl {
18d734a8ceSbeveloper public:
1956f7fdc4SStephan Aßmus 								BOptionControl(BRect frame, const char* name,
2056f7fdc4SStephan Aßmus 									const char* label, BMessage* message,
21*7f9368caSlooncraz 									uint32 resizeMask = B_FOLLOW_LEFT_TOP,
22d734a8ceSbeveloper 									uint32 flags = B_WILL_DRAW);
23ba69bf19SStefano Ceccherini 								BOptionControl(const char* name,
24ba69bf19SStefano Ceccherini 									const char* label, BMessage* message,
25ba69bf19SStefano Ceccherini 									uint32 flags = B_WILL_DRAW);
26ba69bf19SStefano Ceccherini 
27d734a8ceSbeveloper 	virtual						~BOptionControl();
28d734a8ceSbeveloper 
293c5bd344SStefano Ceccherini 	virtual	void				MessageReceived(BMessage* message);
30d734a8ceSbeveloper 
313c5bd344SStefano Ceccherini 			status_t			AddOption(const char* name, int32 value);
3256f7fdc4SStephan Aßmus 	virtual	bool				GetOptionAt(int32 index, const char** _name,
3356f7fdc4SStephan Aßmus 									int32* _value) = 0;
343c5bd344SStefano Ceccherini 	virtual	void				RemoveOptionAt(int32 index) = 0;
35d734a8ceSbeveloper 	virtual	int32				CountOptions() const = 0;
363c5bd344SStefano Ceccherini 	virtual	status_t			AddOptionAt(const char* name, int32 value,
37d734a8ceSbeveloper 									int32 index) = 0;
3856f7fdc4SStephan Aßmus 	virtual	int32				SelectedOption(const char** name = NULL,
3956f7fdc4SStephan Aßmus 									int32* outValue = NULL) const = 0;
40d734a8ceSbeveloper 
413c5bd344SStefano Ceccherini 	virtual	status_t			SelectOptionFor(int32 value);
423c5bd344SStefano Ceccherini 	virtual	status_t			SelectOptionFor(const char* name);
433c5bd344SStefano Ceccherini 
44d734a8ceSbeveloper protected:
453c5bd344SStefano Ceccherini 			BMessage*			MakeValueMessage(int32 value);
46d734a8ceSbeveloper 
47d734a8ceSbeveloper private:
4856f7fdc4SStephan Aßmus 	// FBC padding and forbidden methods
493c5bd344SStefano Ceccherini 								BOptionControl();
5056f7fdc4SStephan Aßmus 								BOptionControl(const BOptionControl& other);
5156f7fdc4SStephan Aßmus 			BOptionControl&		operator=(const BOptionControl& other);
52d734a8ceSbeveloper 
53d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_0(void*, ...);
54d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_1(void*, ...);
55d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_2(void*, ...);
56d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_3(void*, ...);
57d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_4(void*, ...);
58d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_5(void*, ...);
59d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_6(void*, ...);
60d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_7(void*, ...);
61d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_8(void*, ...);
62d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_9(void*, ...);
63d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_10(void*, ...);
64d734a8ceSbeveloper 	virtual	status_t			_Reserved_OptionControl_11(void*, ...);
65d734a8ceSbeveloper 
6656f7fdc4SStephan Aßmus private:
6756f7fdc4SStephan Aßmus 			uint32				_reserved[8];
68d734a8ceSbeveloper };
69d734a8ceSbeveloper 
70d734a8ceSbeveloper 
7156f7fdc4SStephan Aßmus #endif // _OPTION_CONTROL_H
72