1/*
2 * Copyright 2001-2008, 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 resizMask
18										= B_FOLLOW_LEFT | B_FOLLOW_TOP,
19									uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
20								BRadioButton(const char* name,
21									const char* label, BMessage* message,
22									uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
23								BRadioButton(const char* label,
24									BMessage* message);
25
26								BRadioButton(BMessage* archive);
27	virtual						~BRadioButton();
28
29	static	BArchivable*		Instantiate(BMessage* archive);
30	virtual	status_t			Archive(BMessage* archive,
31									bool deep = true) const;
32
33	virtual	void				Draw(BRect updateRect);
34	virtual	void				MouseDown(BPoint point);
35	virtual	void				AttachedToWindow();
36	virtual	void				KeyDown(const char* bytes, int32 numBytes);
37	virtual	void				SetValue(int32 value);
38	virtual	void				GetPreferredSize(float* _width,
39									float* _height);
40	virtual	void				ResizeToPreferred();
41	virtual	status_t			Invoke(BMessage* message = NULL);
42
43	virtual	void				MessageReceived(BMessage* message);
44	virtual	void				WindowActivated(bool active);
45	virtual	void				MouseUp(BPoint point);
46	virtual	void				MouseMoved(BPoint point, uint32 transit,
47									const BMessage* dragMessage);
48	virtual	void				DetachedFromWindow();
49	virtual	void				FrameMoved(BPoint newLocation);
50	virtual	void				FrameResized(float width, float height);
51
52	virtual	BHandler*			ResolveSpecifier(BMessage* message,
53									int32 index, BMessage* specifier,
54									int32 what, const char* property);
55
56	virtual	void				MakeFocus(bool focused = true);
57	virtual	void				AllAttached();
58	virtual	void				AllDetached();
59	virtual	status_t			GetSupportedSuites(BMessage* message);
60
61	virtual	status_t			Perform(perform_code d, void* argument);
62
63	virtual	BSize				MaxSize();
64
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