xref: /haiku/headers/os/interface/RadioButton.h (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 //------------------------------------------------------------------------------
2 //	Copyright (c) 2001-2002, OpenBeOS
3 //
4 //	Permission is hereby granted, free of charge, to any person obtaining a
5 //	copy of this software and associated documentation files (the "Software"),
6 //	to deal in the Software without restriction, including without limitation
7 //	the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 //	and/or sell copies of the Software, and to permit persons to whom the
9 //	Software is furnished to do so, subject to the following conditions:
10 //
11 //	The above copyright notice and this permission notice shall be included in
12 //	all copies or substantial portions of the Software.
13 //
14 //	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 //	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 //	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 //	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 //	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 //	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 //	DEALINGS IN THE SOFTWARE.
21 //
22 //	File Name:		RadioButton.cpp
23 //	Author:			Marc Flerackers (mflerackers@androme.be)
24 //	Description:	BRadioButton represents a single on/off button.  All
25 //                  sibling BRadioButton objects comprise a single
26 //                  "multiple choice" control.
27 //------------------------------------------------------------------------------
28 
29 #ifndef	_RADIO_BUTTON_H
30 #define	_RADIO_BUTTON_H
31 
32 // Standard Includes -----------------------------------------------------------
33 
34 // System Includes -------------------------------------------------------------
35 #include <BeBuild.h>
36 #include <Control.h>
37 #include <Bitmap.h>
38 
39 // Project Includes ------------------------------------------------------------
40 
41 // Local Includes --------------------------------------------------------------
42 
43 // Local Defines ---------------------------------------------------------------
44 
45 // Globals ---------------------------------------------------------------------
46 
47 // BRadioButton class ----------------------------------------------------------
48 class BRadioButton : public BControl {
49 
50 public:
51 						BRadioButton(BRect frame,
52 								const char *name,
53 								const char *label,
54 								BMessage *message,
55 								uint32 resizMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
56 								uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
57 
58 						BRadioButton(BMessage *archive);
59 virtual					~BRadioButton();
60 
61 static	BArchivable		*Instantiate(BMessage *archive);
62 virtual	status_t		Archive(BMessage *archive, bool deep = true) const;
63 
64 virtual	void			Draw(BRect updateRect);
65 virtual	void			MouseDown(BPoint point);
66 virtual	void			AttachedToWindow();
67 virtual	void			KeyDown(const char *bytes, int32 numBytes);
68 virtual	void			SetValue(int32 value);
69 virtual	void			GetPreferredSize(float *width, float *height);
70 virtual void			ResizeToPreferred();
71 virtual	status_t		Invoke(BMessage *message = NULL);
72 
73 virtual void			MessageReceived(BMessage *message);
74 virtual void			WindowActivated(bool active);
75 virtual	void			MouseUp(BPoint point);
76 virtual	void			MouseMoved(BPoint point, uint32 transit, const BMessage *message);
77 virtual	void			DetachedFromWindow();
78 virtual	void			FrameMoved(BPoint newLocation);
79 virtual	void			FrameResized(float width, float height);
80 
81 virtual BHandler		*ResolveSpecifier(BMessage *message,
82 										int32 index,
83 										BMessage *specifier,
84 										int32 what,
85 										const char *property);
86 
87 virtual void			MakeFocus(bool focused = true);
88 virtual void			AllAttached();
89 virtual void			AllDetached();
90 virtual status_t		GetSupportedSuites(BMessage *message);
91 
92 virtual status_t		Perform(perform_code d, void *arg);
93 
94 private:
95 friend	status_t		_init_interface_kit_();
96 
97 virtual	void			_ReservedRadioButton1();
98 virtual	void			_ReservedRadioButton2();
99 
100 		BRadioButton	&operator=(const BRadioButton &);
101 static	BBitmap			*sBitmaps[2][3];
102 
103 		bool			fOutlined;
104 		uint32			_reserved[2];
105 };
106 //------------------------------------------------------------------------------
107 
108 #endif // _RADIO_BUTTON_H
109 
110 /*
111  * $Log $
112  *
113  * $Id  $
114  *
115  */
116