Fix more class/struct mixups.
[haiku.git] / headers / os / interface / CheckBox.h
blob056f03454826e301a721200922106c1de92f0b31
1 /*
2 * Copyright 2001-2015 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
9 #include <Control.h>
12 class BCheckBox : public BControl {
13 public:
14 BCheckBox(BRect frame, const char* name,
15 const char* label, BMessage* message,
16 uint32 resizingMode = B_FOLLOW_LEFT_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* data);
25 virtual ~BCheckBox();
27 static BArchivable* Instantiate(BMessage* data);
28 virtual status_t Archive(BMessage* data, bool deep = true) const;
30 virtual void Draw(BRect updateRect);
32 virtual void AttachedToWindow();
33 virtual void DetachedFromWindow();
34 virtual void AllAttached();
35 virtual void AllDetached();
37 virtual void FrameMoved(BPoint newPosition);
38 virtual void FrameResized(float newWidth, float newHeight);
39 virtual void WindowActivated(bool active);
41 virtual void MessageReceived(BMessage* message);
43 virtual void KeyDown(const char* bytes, int32 numBytes);
45 virtual void MouseDown(BPoint where);
46 virtual void MouseUp(BPoint where);
47 virtual void MouseMoved(BPoint where, uint32 code,
48 const BMessage* dragMessage);
50 virtual void GetPreferredSize(float* _width,
51 float* _height);
52 virtual void ResizeToPreferred();
54 virtual BSize MinSize();
55 virtual BSize MaxSize();
56 virtual BSize PreferredSize();
57 virtual BAlignment LayoutAlignment();
59 virtual void MakeFocus(bool focused = true);
61 virtual void SetValue(int32 value);
62 virtual status_t Invoke(BMessage* message = NULL);
64 virtual BHandler* ResolveSpecifier(BMessage* message,
65 int32 index, BMessage* specifier,
66 int32 what, const char* property);
67 virtual status_t GetSupportedSuites(BMessage* message);
69 virtual status_t Perform(perform_code code, void* data);
71 virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
73 bool IsPartialStateToOff() const;
74 void SetPartialStateToOff(bool partialToOff);
76 protected:
77 virtual void LayoutInvalidated(bool descendants = false);
79 private:
80 // FBC padding
81 virtual void _ReservedCheckBox1();
82 virtual void _ReservedCheckBox2();
83 virtual void _ReservedCheckBox3();
85 private:
86 inline BRect _CheckBoxFrame(const font_height& fontHeight)
87 const;
88 BRect _CheckBoxFrame() const;
89 BSize _ValidatePreferredSize();
90 int32 _NextState() const;
92 private:
93 // Forbidden
94 BCheckBox& operator=(const BCheckBox&);
96 private:
97 BSize fPreferredSize;
98 bool fOutlined;
99 bool fPartialToOff;
103 #endif // _CHECK_BOX_H