xref: /haiku/headers/os/interface/CheckBox.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2001-2009, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _CHECK_BOX_H
6 #define _CHECK_BOX_H
7 
8 #include <Control.h>
9 
10 
11 class BCheckBox : public BControl {
12 public:
13 								BCheckBox(BRect frame, const char* name,
14 									const char* label, BMessage* message,
15 									uint32 resizingMode
16 										= B_FOLLOW_LEFT | B_FOLLOW_TOP,
17 									uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
18 								BCheckBox(const char* name, const char* label,
19 									BMessage* message, uint32 flags
20 										= B_WILL_DRAW | B_NAVIGABLE);
21 								BCheckBox(const char* label,
22 									BMessage* message = NULL);
23 								BCheckBox(BMessage* archive);
24 
25 	virtual						~BCheckBox();
26 
27 	static	BArchivable*		Instantiate(BMessage* archive);
28 	virtual	status_t			Archive(BMessage* archive,
29 									bool deep = true) const;
30 
31 	virtual	void				Draw(BRect updateRect);
32 
33 	virtual	void				AttachedToWindow();
34 	virtual	void				DetachedFromWindow();
35 	virtual	void				AllAttached();
36 	virtual	void				AllDetached();
37 
38 	virtual	void				FrameMoved(BPoint newLocation);
39 	virtual	void				FrameResized(float width, float height);
40 	virtual	void				WindowActivated(bool active);
41 
42 	virtual	void				MessageReceived(BMessage* message);
43 
44 	virtual	void				KeyDown(const char* bytes, int32 numBytes);
45 
46 	virtual	void				MouseDown(BPoint point);
47 	virtual	void				MouseUp(BPoint point);
48 	virtual	void				MouseMoved(BPoint point, uint32 transit,
49 									const BMessage* dragMessage);
50 
51 	virtual	void				GetPreferredSize(float* _width,
52 									float* _height);
53 	virtual	void				ResizeToPreferred();
54 
55 	virtual	BSize				MinSize();
56 	virtual	BSize				MaxSize();
57 	virtual	BSize				PreferredSize();
58 	virtual	BAlignment			LayoutAlignment();
59 
60 	virtual	void				MakeFocus(bool focused = true);
61 
62 	virtual	void				SetValue(int32 value);
63 	virtual	status_t			Invoke(BMessage* message = NULL);
64 
65 	virtual	BHandler*			ResolveSpecifier(BMessage* message,
66 									int32 index, BMessage* specifier,
67 									int32 what, const char* property);
68 	virtual	status_t			GetSupportedSuites(BMessage* message);
69 
70 	virtual	status_t			Perform(perform_code code, void* data);
71 
72 protected:
73 	virtual	void				LayoutInvalidated(bool descendants = false);
74 
75 private:
76 	// FBC padding
77 	virtual	void				_ReservedCheckBox1();
78 	virtual	void				_ReservedCheckBox2();
79 	virtual	void				_ReservedCheckBox3();
80 
81 private:
82 			BRect				_CheckBoxFrame() const;
83 			BSize				_ValidatePreferredSize();
84 
85 private:
86 	// Forbidden
87 			BCheckBox&			operator=(const BCheckBox&);
88 
89 private:
90 			BSize				fPreferredSize;
91 			bool				fOutlined;
92 };
93 
94 #endif // _CHECK_BOX_H
95 
96