| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: wx/univ/button.h |
| 3 | // Purpose: wxToggleButton for wxUniversal |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Modified by: David Bjorkevik |
| 6 | // Created: 16.05.06 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
| 9 | // Licence: wxWindows licence |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | #ifndef _WX_UNIV_TGLBTN_H_ |
| 13 | #define _WX_UNIV_TGLBTN_H_ |
| 14 | |
| 15 | #include "wx/button.h" |
| 16 | |
| 17 | extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[]; |
| 18 | |
| 19 | // ---------------------------------------------------------------------------- |
| 20 | // wxToggleButton: a push button |
| 21 | // ---------------------------------------------------------------------------- |
| 22 | |
| 23 | class WXDLLIMPEXP_CORE wxToggleButton: public wxButton |
| 24 | { |
| 25 | public: |
| 26 | wxToggleButton(); |
| 27 | |
| 28 | wxToggleButton(wxWindow *parent, |
| 29 | wxWindowID id, |
| 30 | const wxBitmap& bitmap, |
| 31 | const wxString& label = wxEmptyString, |
| 32 | const wxPoint& pos = wxDefaultPosition, |
| 33 | const wxSize& size = wxDefaultSize, |
| 34 | long style = 0, |
| 35 | const wxValidator& validator = wxDefaultValidator, |
| 36 | const wxString& name = wxCheckBoxNameStr); |
| 37 | |
| 38 | wxToggleButton(wxWindow *parent, |
| 39 | wxWindowID id, |
| 40 | const wxString& label = wxEmptyString, |
| 41 | const wxPoint& pos = wxDefaultPosition, |
| 42 | const wxSize& size = wxDefaultSize, |
| 43 | long style = 0, |
| 44 | const wxValidator& validator = wxDefaultValidator, |
| 45 | const wxString& name = wxCheckBoxNameStr); |
| 46 | |
| 47 | virtual ~wxToggleButton(); |
| 48 | |
| 49 | virtual bool IsPressed() const { return m_isPressed || m_value; } |
| 50 | |
| 51 | // wxToggleButton actions |
| 52 | virtual void Toggle(); |
| 53 | virtual void Click(); |
| 54 | |
| 55 | // Get/set the value |
| 56 | void SetValue(bool state); |
| 57 | bool GetValue() const { return m_value; } |
| 58 | |
| 59 | protected: |
| 60 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } |
| 61 | |
| 62 | // the current value |
| 63 | bool m_value; |
| 64 | |
| 65 | private: |
| 66 | // common part of all ctors |
| 67 | void Init(); |
| 68 | |
| 69 | DECLARE_DYNAMIC_CLASS(wxToggleButton) |
| 70 | }; |
| 71 | |
| 72 | #endif // _WX_UNIV_TGLBTN_H_ |