| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/univ/radiobut.h |
| 3 | // Purpose: wxRadioButton declaration |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Modified by: |
| 6 | // Created: 10.09.00 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
| 9 | // Licence: wxWindows licence |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_UNIV_RADIOBUT_H_ |
| 13 | #define _WX_UNIV_RADIOBUT_H_ |
| 14 | |
| 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
| 16 | #pragma interface "univradiobut.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/checkbox.h" |
| 20 | |
| 21 | // ---------------------------------------------------------------------------- |
| 22 | // wxRadioButton |
| 23 | // ---------------------------------------------------------------------------- |
| 24 | |
| 25 | class WXDLLEXPORT wxRadioButton : public wxCheckBox |
| 26 | { |
| 27 | public: |
| 28 | // constructors |
| 29 | wxRadioButton() { Init(); } |
| 30 | |
| 31 | wxRadioButton(wxWindow *parent, |
| 32 | wxWindowID id, |
| 33 | const wxString& label, |
| 34 | const wxPoint& pos = wxDefaultPosition, |
| 35 | const wxSize& size = wxDefaultSize, |
| 36 | long style = 0, |
| 37 | const wxValidator& validator = wxDefaultValidator, |
| 38 | const wxString& name = wxRadioButtonNameStr) |
| 39 | { |
| 40 | Init(); |
| 41 | |
| 42 | Create(parent, id, label, pos, size, style, validator, name); |
| 43 | } |
| 44 | |
| 45 | bool Create(wxWindow *parent, |
| 46 | wxWindowID id, |
| 47 | const wxString& label, |
| 48 | const wxPoint& pos = wxDefaultPosition, |
| 49 | const wxSize& size = wxDefaultSize, |
| 50 | long style = 0, |
| 51 | const wxValidator& validator = wxDefaultValidator, |
| 52 | const wxString& name = wxRadioButtonNameStr); |
| 53 | |
| 54 | // override some base class methods |
| 55 | virtual void ChangeValue(bool value); |
| 56 | |
| 57 | protected: |
| 58 | // implement our own drawing |
| 59 | virtual void DoDraw(wxControlRenderer *renderer); |
| 60 | |
| 61 | // we use the radio button bitmaps for size calculation |
| 62 | virtual wxSize GetBitmapSize() const; |
| 63 | |
| 64 | // the radio button can only be cleared using this method, not |
| 65 | // ChangeValue() above - and it is protected as it can only be called by |
| 66 | // another radiobutton |
| 67 | void ClearValue(); |
| 68 | |
| 69 | // called when the radio button becomes checked: we clear all the buttons |
| 70 | // in the same group with us here |
| 71 | virtual void OnCheck(); |
| 72 | |
| 73 | // send event about radio button selection |
| 74 | virtual void SendEvent(); |
| 75 | |
| 76 | private: |
| 77 | DECLARE_DYNAMIC_CLASS(wxRadioButton) |
| 78 | }; |
| 79 | |
| 80 | #endif // _WX_UNIV_RADIOBUT_H_ |