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 59 virtual void MakeFocus(bool focused = true); 60 61 virtual void SetValue(int32 value); 62 virtual status_t Invoke(BMessage* message = NULL); 63 64 virtual BHandler* ResolveSpecifier(BMessage* message, 65 int32 index, BMessage* specifier, 66 int32 what, const char* property); 67 virtual status_t GetSupportedSuites(BMessage* message); 68 69 virtual status_t Perform(perform_code code, void* data); 70 71 protected: 72 virtual void LayoutInvalidated(bool descendants = false); 73 74 private: 75 // FBC padding 76 virtual void _ReservedCheckBox1(); 77 virtual void _ReservedCheckBox2(); 78 virtual void _ReservedCheckBox3(); 79 80 private: 81 BRect _CheckBoxFrame() const; 82 BSize _ValidatePreferredSize(); 83 84 private: 85 // Forbidden 86 BCheckBox& operator=(const BCheckBox&); 87 88 private: 89 BSize fPreferredSize; 90 bool fOutlined; 91 }; 92 93 #endif // _CHECK_BOX_H 94 95