tglbtn.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/univ/tglbtn.h
  3. // Purpose: wxToggleButton for wxUniversal
  4. // Author: Vadim Zeitlin
  5. // Modified by: David Bjorkevik
  6. // Created: 16.05.06
  7. // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_UNIV_TGLBTN_H_
  11. #define _WX_UNIV_TGLBTN_H_
  12. #include "wx/button.h"
  13. // ----------------------------------------------------------------------------
  14. // wxToggleButton: a push button
  15. // ----------------------------------------------------------------------------
  16. class WXDLLIMPEXP_CORE wxToggleButton: public wxButton
  17. {
  18. public:
  19. wxToggleButton();
  20. wxToggleButton(wxWindow *parent,
  21. wxWindowID id,
  22. const wxBitmap& bitmap,
  23. const wxString& label = wxEmptyString,
  24. const wxPoint& pos = wxDefaultPosition,
  25. const wxSize& size = wxDefaultSize,
  26. long style = 0,
  27. const wxValidator& validator = wxDefaultValidator,
  28. const wxString& name = wxCheckBoxNameStr);
  29. wxToggleButton(wxWindow *parent,
  30. wxWindowID id,
  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. virtual ~wxToggleButton();
  38. virtual bool IsPressed() const { return m_isPressed || m_value; }
  39. // wxToggleButton actions
  40. virtual void Toggle();
  41. virtual void Click();
  42. // Get/set the value
  43. void SetValue(bool state);
  44. bool GetValue() const { return m_value; }
  45. protected:
  46. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  47. // the current value
  48. bool m_value;
  49. private:
  50. // common part of all ctors
  51. void Init();
  52. DECLARE_DYNAMIC_CLASS(wxToggleButton)
  53. };
  54. #endif // _WX_UNIV_TGLBTN_H_