RadioButton.h revision b29d84a8
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 resizingMode
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* data);
27	virtual						~BRadioButton();
28
29	static	BArchivable*		Instantiate(BMessage* data);
30	virtual	status_t			Archive(BMessage* data, bool deep = true) const;
31
32	virtual	void				Draw(BRect updateRect);
33	virtual	void				MouseDown(BPoint where);
34	virtual	void				AttachedToWindow();
35	virtual	void				KeyDown(const char* bytes, int32 numBytes);
36	virtual	void				SetValue(int32 value);
37	virtual	void				GetPreferredSize(float* _width,
38									float* _height);
39	virtual	void				ResizeToPreferred();
40	virtual	status_t			Invoke(BMessage* message = NULL);
41
42	virtual	void				MessageReceived(BMessage* message);
43	virtual	void				WindowActivated(bool active);
44	virtual	void				MouseUp(BPoint where);
45	virtual	void				MouseMoved(BPoint where, uint32 code,
46									const BMessage* dragMessage);
47	virtual	void				DetachedFromWindow();
48	virtual	void				FrameMoved(BPoint newPosition);
49	virtual	void				FrameResized(float width, float height);
50
51	virtual	BHandler*			ResolveSpecifier(BMessage* message,
52									int32 index, BMessage* specifier,
53									int32 what, const char* property);
54
55	virtual	void				MakeFocus(bool focused = true);
56	virtual	void				AllAttached();
57	virtual	void				AllDetached();
58	virtual	status_t			GetSupportedSuites(BMessage* message);
59
60	virtual	status_t			Perform(perform_code d, void* argument);
61
62	virtual	BSize				MaxSize();
63	virtual	BAlignment			LayoutAlignment();
64
65	virtual	status_t			SetIcon(const BBitmap* icon, uint32 flags = 0);
66
67private:
68	friend	status_t			_init_interface_kit_();
69
70	virtual	void				_ReservedRadioButton1();
71	virtual	void				_ReservedRadioButton2();
72
73			BRadioButton&		operator=(const BRadioButton& other);
74
75			BRect				_KnobFrame() const;
76			BRect				_KnobFrame(
77									const font_height& fontHeight) const;
78			void				_Redraw();
79				// for use in "synchronous" BWindows
80
81private:
82	static	BBitmap*			sBitmaps[2][3];
83
84			bool				fOutlined;
85
86			uint32				_reserved[2];
87};
88
89#endif // _RADIO_BUTTON_H
90