1/*
2 * Copyright 2001-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef	_RADIO_BUTTON_H
6#define	_RADIO_BUTTON_H
7
8
9#include <Bitmap.h>
10#include <Control.h>
11
12
13class BRadioButton : public BControl {
14public:
15								BRadioButton(BRect frame, const char* name,
16									const char* label, BMessage* message,
17									uint32 resizingMode = B_FOLLOW_LEFT_TOP,
18									uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
19								BRadioButton(const char* name,
20									const char* label, BMessage* message,
21									uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
22								BRadioButton(const char* label,
23									BMessage* message);
24
25								BRadioButton(BMessage* data);
26	virtual						~BRadioButton();
27
28	static	BArchivable*		Instantiate(BMessage* data);
29	virtual	status_t			Archive(BMessage* data, bool deep = true) const;
30
31	virtual	void				Draw(BRect updateRect);
32	virtual	void				MouseDown(BPoint where);
33	virtual	void				AttachedToWindow();
34	virtual	void				KeyDown(const char* bytes, int32 numBytes);
35	virtual	void				SetValue(int32 value);
36	virtual	void				GetPreferredSize(float* _width,
37									float* _height);
38	virtual	void				ResizeToPreferred();
39	virtual	status_t			Invoke(BMessage* message = NULL);
40
41	virtual	void				MessageReceived(BMessage* message);
42	virtual	void				WindowActivated(bool active);
43	virtual	void				MouseUp(BPoint where);
44	virtual	void				MouseMoved(BPoint where, uint32 code,
45									const BMessage* dragMessage);
46	virtual	void				DetachedFromWindow();
47	virtual	void				FrameMoved(BPoint newPosition);
48	virtual	void				FrameResized(float newWidth, float newHeight);
49
50	virtual	BHandler*			ResolveSpecifier(BMessage* message,
51									int32 index, BMessage* specifier,
52									int32 what, const char* property);
53
54	virtual	void				MakeFocus(bool focus = true);
55	virtual	void				AllAttached();
56	virtual	void				AllDetached();
57	virtual	status_t			GetSupportedSuites(BMessage* message);
58
59	virtual	status_t			Perform(perform_code d, void* argument);
60
61	virtual	BSize				MaxSize();
62	virtual	BAlignment			LayoutAlignment();
63
64	virtual	status_t			SetIcon(const BBitmap* icon, uint32 flags = 0);
65
66private:
67	friend	status_t			_init_interface_kit_();
68
69	virtual	void				_ReservedRadioButton1();
70	virtual	void				_ReservedRadioButton2();
71
72			BRadioButton&		operator=(const BRadioButton& other);
73
74			BRect				_KnobFrame() const;
75			BRect				_KnobFrame(
76									const font_height& fontHeight) const;
77			void				_Redraw();
78				// for use in "synchronous" BWindows
79
80private:
81	static	BBitmap*			sBitmaps[2][3];
82
83			bool				fOutlined;
84
85			uint32				_reserved[2];
86};
87
88#endif // _RADIO_BUTTON_H
89