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 BRadioButton(const char *name, 58 const char *label, 59 BMessage *message, 60 uint32 flags = B_WILL_DRAW | B_NAVIGABLE); 61 BRadioButton(const char *label, 62 BMessage *message); 63 64 BRadioButton(BMessage *archive); 65 virtual ~BRadioButton(); 66 67 static BArchivable *Instantiate(BMessage *archive); 68 virtual status_t Archive(BMessage *archive, bool deep = true) const; 69 70 virtual void Draw(BRect updateRect); 71 virtual void MouseDown(BPoint point); 72 virtual void AttachedToWindow(); 73 virtual void KeyDown(const char *bytes, int32 numBytes); 74 virtual void SetValue(int32 value); 75 virtual void GetPreferredSize(float *width, float *height); 76 virtual void ResizeToPreferred(); 77 virtual status_t Invoke(BMessage *message = NULL); 78 79 virtual void MessageReceived(BMessage *message); 80 virtual void WindowActivated(bool active); 81 virtual void MouseUp(BPoint point); 82 virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); 83 virtual void DetachedFromWindow(); 84 virtual void FrameMoved(BPoint newLocation); 85 virtual void FrameResized(float width, float height); 86 87 virtual BHandler *ResolveSpecifier(BMessage *message, 88 int32 index, 89 BMessage *specifier, 90 int32 what, 91 const char *property); 92 93 virtual void MakeFocus(bool focused = true); 94 virtual void AllAttached(); 95 virtual void AllDetached(); 96 virtual status_t GetSupportedSuites(BMessage *message); 97 98 virtual status_t Perform(perform_code d, void *arg); 99 100 virtual BSize MaxSize(); 101 102 103 private: 104 friend status_t _init_interface_kit_(); 105 106 virtual void _ReservedRadioButton1(); 107 virtual void _ReservedRadioButton2(); 108 109 BRadioButton &operator=(const BRadioButton &); 110 111 BRect _KnobFrame() const; 112 // for use in "synchronous" BWindows 113 void _Redraw(); 114 115 static BBitmap *sBitmaps[2][3]; 116 117 bool fOutlined; 118 uint32 _reserved[2]; 119 }; 120 //------------------------------------------------------------------------------ 121 122 #endif // _RADIO_BUTTON_H 123 124 /* 125 * $Log $ 126 * 127 * $Id $ 128 * 129 */ 130