| 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 | #include "wx/checkbox.h" |
| 16 | |
| 17 | // ---------------------------------------------------------------------------- |
| 18 | // wxRadioButton |
| 19 | // ---------------------------------------------------------------------------- |
| 20 | |
| 21 | class WXDLLEXPORT wxRadioButton : public wxCheckBox |
| 22 | { |
| 23 | public: |
| 24 | // constructors |
| 25 | wxRadioButton() { Init(); } |
| 26 | |
| 27 | wxRadioButton(wxWindow *parent, |
| 28 | wxWindowID id, |
| 29 | const wxString& label, |
| 30 | const wxPoint& pos = wxDefaultPosition, |
| 31 | const wxSize& size = wxDefaultSize, |
| 32 | long style = 0, |
| 33 | const wxValidator& validator = wxDefaultValidator, |
| 34 | const wxString& name = wxRadioButtonNameStr) |
| 35 | { |
| 36 | Init(); |
| 37 | |
| 38 | Create(parent, id, label, pos, size, style, validator, name); |
| 39 | } |
| 40 | |
| 41 | bool Create(wxWindow *parent, |
| 42 | wxWindowID id, |
| 43 | const wxString& label, |
| 44 | const wxPoint& pos = wxDefaultPosition, |
| 45 | const wxSize& size = wxDefaultSize, |
| 46 | long style = 0, |
| 47 | const wxValidator& validator = wxDefaultValidator, |
| 48 | const wxString& name = wxRadioButtonNameStr); |
| 49 | |
| 50 | // override some base class methods |
| 51 | virtual void ChangeValue(bool value); |
| 52 | |
| 53 | protected: |
| 54 | // implement our own drawing |
| 55 | virtual void DoDraw(wxControlRenderer *renderer); |
| 56 | |
| 57 | // we use the radio button bitmaps for size calculation |
| 58 | virtual wxSize GetBitmapSize() const; |
| 59 | |
| 60 | // the radio button can only be cleared using this method, not |
| 61 | // ChangeValue() above - and it is protected as it can only be called by |
| 62 | // another radiobutton |
| 63 | void ClearValue(); |
| 64 | |
| 65 | // called when the radio button becomes checked: we clear all the buttons |
| 66 | // in the same group with us here |
| 67 | virtual void OnCheck(); |
| 68 | |
| 69 | // send event about radio button selection |
| 70 | virtual void SendEvent(); |
| 71 | |
| 72 | private: |
| 73 | DECLARE_DYNAMIC_CLASS(wxRadioButton) |
| 74 | }; |
| 75 | |
| 76 | #endif // _WX_UNIV_RADIOBUT_H_ |