radiobut.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/radiobut.h
  3. // Purpose: wxRadioButton class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_RADIOBUT_H_
  11. #define _WX_RADIOBUT_H_
  12. class WXDLLIMPEXP_CORE wxRadioButton: public wxControl
  13. {
  14. public:
  15. // ctors and creation functions
  16. wxRadioButton() { Init(); }
  17. wxRadioButton(wxWindow *parent,
  18. wxWindowID id,
  19. const wxString& label,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. long style = 0,
  23. const wxValidator& validator = wxDefaultValidator,
  24. const wxString& name = wxRadioButtonNameStr)
  25. {
  26. Init();
  27. Create(parent, id, label, pos, size, style, validator, name);
  28. }
  29. bool Create(wxWindow *parent,
  30. wxWindowID id,
  31. const wxString& label,
  32. const wxPoint& pos = wxDefaultPosition,
  33. const wxSize& size = wxDefaultSize,
  34. long style = 0,
  35. const wxValidator& validator = wxDefaultValidator,
  36. const wxString& name = wxRadioButtonNameStr);
  37. // implement the radio button interface
  38. virtual void SetValue(bool value);
  39. virtual bool GetValue() const;
  40. // implementation only from now on
  41. virtual bool MSWCommand(WXUINT param, WXWORD id);
  42. virtual void Command(wxCommandEvent& event);
  43. virtual bool HasTransparentBackground() { return true; }
  44. virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
  45. protected:
  46. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  47. virtual wxSize DoGetBestSize() const;
  48. private:
  49. // common part of all ctors
  50. void Init();
  51. // we need to store the state internally as the result of GetValue()
  52. // sometimes gets out of sync in WM_COMMAND handler
  53. bool m_isChecked;
  54. DECLARE_DYNAMIC_CLASS_NO_COPY(wxRadioButton)
  55. };
  56. #endif
  57. // _WX_RADIOBUT_H_