radiobut.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/radiobut.h
  3. // Purpose: wxRadioButton class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2003/03/18
  7. // Copyright: (c) 2003 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef __WX_COCOA_RADIOBUT_H__
  11. #define __WX_COCOA_RADIOBUT_H__
  12. #include "wx/cocoa/NSButton.h"
  13. class WXDLLIMPEXP_FWD_CORE wxRadioButton;
  14. WX_DECLARE_EXPORTED_LIST(wxRadioButton, wxRadioButtonList);
  15. // ========================================================================
  16. // wxRadioButton
  17. // ========================================================================
  18. class WXDLLIMPEXP_CORE wxRadioButton: public wxControl, protected wxCocoaNSButton
  19. {
  20. DECLARE_DYNAMIC_CLASS(wxRadioButton)
  21. DECLARE_EVENT_TABLE()
  22. WX_DECLARE_COCOA_OWNER(NSButton,NSControl,NSView)
  23. // ------------------------------------------------------------------------
  24. // initialization
  25. // ------------------------------------------------------------------------
  26. public:
  27. wxRadioButton() { m_radioMaster = NULL; }
  28. wxRadioButton(wxWindow *parent, wxWindowID winid,
  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. Create(parent, winid, label, pos, size, style, validator, name);
  37. }
  38. bool Create(wxWindow *parent, wxWindowID winid,
  39. const wxString& label,
  40. const wxPoint& pos = wxDefaultPosition,
  41. const wxSize& size = wxDefaultSize,
  42. long style = 0,
  43. const wxValidator& validator = wxDefaultValidator,
  44. const wxString& name = wxRadioButtonNameStr);
  45. virtual ~wxRadioButton();
  46. // ------------------------------------------------------------------------
  47. // Cocoa callbacks
  48. // ------------------------------------------------------------------------
  49. protected:
  50. virtual void Cocoa_wxNSButtonAction(void);
  51. private:
  52. void Cocoa_DeselectOtherButtonsInTheGroup(void);
  53. // ------------------------------------------------------------------------
  54. // Implementation
  55. // ------------------------------------------------------------------------
  56. public:
  57. virtual void SetValue(bool);
  58. virtual bool GetValue() const;
  59. virtual void SetLabel(const wxString& label);
  60. virtual wxString GetLabel() const;
  61. protected:
  62. wxRadioButtonList m_radioSlaves;
  63. wxRadioButton *m_radioMaster;
  64. };
  65. #endif // __WX_COCOA_RADIOBUT_H__