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