xref: /haiku/headers/os/interface/RadioButton.h (revision a4ef4a49150f118d47324242917a596a3f8f8bd5)
1 /*
2  * Copyright (c) 2001-2008, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT/X11 license.
4  */
5 #ifndef	_RADIO_BUTTON_H
6 #define	_RADIO_BUTTON_H
7 
8 #include <BeBuild.h>
9 #include <Control.h>
10 #include <Bitmap.h>
11 
12 class BRadioButton : public BControl {
13 public:
14 								BRadioButton(BRect frame, const char* name,
15 									const char* label, BMessage* message,
16 									uint32 resizMask
17 										= B_FOLLOW_LEFT | B_FOLLOW_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* archive);
26 	virtual						~BRadioButton();
27 
28 	static	BArchivable*		Instantiate(BMessage* archive);
29 	virtual	status_t			Archive(BMessage* archive,
30 									bool deep = true) const;
31 
32 	virtual	void				Draw(BRect updateRect);
33 	virtual	void				MouseDown(BPoint point);
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, 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 point);
44 	virtual	void				MouseMoved(BPoint point, uint32 transit,
45 									const BMessage* dragMessage);
46 	virtual	void				DetachedFromWindow();
47 	virtual	void				FrameMoved(BPoint newLocation);
48 	virtual	void				FrameResized(float width, float height);
49 
50 	virtual	BHandler*			ResolveSpecifier(BMessage* message,
51 									int32 index, BMessage* specifier,
52 									int32 what, const char* property);
53 
54 	virtual	void				MakeFocus(bool focused = 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 
63 
64 private:
65 	friend	status_t			_init_interface_kit_();
66 
67 	virtual	void				_ReservedRadioButton1();
68 	virtual	void				_ReservedRadioButton2();
69 
70 			BRadioButton&		operator=(const BRadioButton& other);
71 
72 			BRect				_KnobFrame() const;
73 			BRect				_KnobFrame(const font_height& fontHeight) const;
74 			void				_Redraw();
75 				// for use in "synchronous" BWindows
76 
77 private:
78 	static	BBitmap*			sBitmaps[2][3];
79 
80 			bool				fOutlined;
81 
82 			uint32				_reserved[2];
83 };
84 
85 #endif // _RADIO_BUTTON_H
86