| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: radiobut.h |
| 3 | // Purpose: wxRadioButton class |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 01/02/97 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows licence |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_RADIOBUT_H_ |
| 13 | #define _WX_RADIOBUT_H_ |
| 14 | |
| 15 | #ifdef __GNUG__ |
| 16 | #pragma interface "radiobut.h" |
| 17 | #endif |
| 18 | |
| 19 | #include "wx/control.h" |
| 20 | |
| 21 | WXDLLEXPORT_DATA(extern const char*) wxRadioButtonNameStr; |
| 22 | |
| 23 | class WXDLLEXPORT wxRadioButton: public wxControl |
| 24 | { |
| 25 | DECLARE_DYNAMIC_CLASS(wxRadioButton) |
| 26 | protected: |
| 27 | public: |
| 28 | wxRadioButton(); |
| 29 | ~wxRadioButton() { RemoveFromCycle(); } |
| 30 | |
| 31 | inline wxRadioButton(wxWindow *parent, wxWindowID id, |
| 32 | const wxString& label, |
| 33 | const wxPoint& pos = wxDefaultPosition, |
| 34 | const wxSize& size = wxDefaultSize, long style = 0, |
| 35 | const wxValidator& validator = wxDefaultValidator, |
| 36 | const wxString& name = wxRadioButtonNameStr) |
| 37 | { |
| 38 | Create(parent, id, label, pos, size, style, validator, name); |
| 39 | } |
| 40 | |
| 41 | bool Create(wxWindow *parent, wxWindowID id, |
| 42 | const wxString& label, |
| 43 | const wxPoint& pos = wxDefaultPosition, |
| 44 | const wxSize& size = wxDefaultSize, long style = 0, |
| 45 | const wxValidator& validator = wxDefaultValidator, |
| 46 | const wxString& name = wxRadioButtonNameStr); |
| 47 | |
| 48 | virtual void SetValue(bool val); |
| 49 | virtual bool GetValue() const ; |
| 50 | |
| 51 | void Command(wxCommandEvent& event); |
| 52 | |
| 53 | // Implementation |
| 54 | virtual void ChangeFont(bool keepOriginalSize = TRUE); |
| 55 | virtual void ChangeBackgroundColour(); |
| 56 | virtual void ChangeForegroundColour(); |
| 57 | |
| 58 | // *this function is an implementation detail* |
| 59 | // clears the selection in the readiobuttons in the cycle |
| 60 | // and returns the old selection (if any) |
| 61 | wxRadioButton* ClearSelections(); |
| 62 | private: |
| 63 | wxRadioButton* AddInCycle(wxRadioButton* cycle); |
| 64 | void RemoveFromCycle(); |
| 65 | wxRadioButton* NextInCycle() { return m_cycle; } |
| 66 | |
| 67 | wxRadioButton *m_cycle; |
| 68 | }; |
| 69 | |
| 70 | // Not implemented |
| 71 | #if 0 |
| 72 | class WXDLLEXPORT wxBitmap ; |
| 73 | |
| 74 | WXDLLEXPORT_DATA(extern const char*) wxBitmapRadioButtonNameStr; |
| 75 | |
| 76 | class WXDLLEXPORT wxBitmapRadioButton: public wxRadioButton |
| 77 | { |
| 78 | DECLARE_DYNAMIC_CLASS(wxBitmapRadioButton) |
| 79 | protected: |
| 80 | wxBitmap *theButtonBitmap; |
| 81 | public: |
| 82 | inline wxBitmapRadioButton() { theButtonBitmap = NULL; } |
| 83 | inline wxBitmapRadioButton(wxWindow *parent, wxWindowID id, |
| 84 | const wxBitmap *label, |
| 85 | const wxPoint& pos = wxDefaultPosition, |
| 86 | const wxSize& size = wxDefaultSize, long style = 0, |
| 87 | const wxValidator& validator = wxDefaultValidator, |
| 88 | const wxString& name = wxBitmapRadioButtonNameStr) |
| 89 | { |
| 90 | Create(parent, id, label, pos, size, style, validator, name); |
| 91 | } |
| 92 | |
| 93 | bool Create(wxWindow *parent, wxWindowID id, |
| 94 | const wxBitmap *label, |
| 95 | const wxPoint& pos = wxDefaultPosition, |
| 96 | const wxSize& size = wxDefaultSize, long style = 0, |
| 97 | const wxValidator& validator = wxDefaultValidator, |
| 98 | const wxString& name = wxBitmapRadioButtonNameStr); |
| 99 | |
| 100 | virtual void SetLabel(const wxBitmap *label); |
| 101 | virtual void SetValue(bool val) ; |
| 102 | virtual bool GetValue() const ; |
| 103 | }; |
| 104 | #endif |
| 105 | |
| 106 | #endif |
| 107 | // _WX_RADIOBUT_H_ |