radiobut.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/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. DECLARE_DYNAMIC_CLASS(wxRadioButton)
  15. public:
  16. wxRadioButton();
  17. virtual ~wxRadioButton() { RemoveFromCycle(); }
  18. inline wxRadioButton(wxWindow *parent, wxWindowID id,
  19. const wxString& label,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize, long style = 0,
  22. const wxValidator& validator = wxDefaultValidator,
  23. const wxString& name = wxRadioButtonNameStr)
  24. {
  25. Create(parent, id, label, pos, size, style, validator, name);
  26. }
  27. bool Create(wxWindow *parent, wxWindowID id,
  28. const wxString& label,
  29. const wxPoint& pos = wxDefaultPosition,
  30. const wxSize& size = wxDefaultSize, long style = 0,
  31. const wxValidator& validator = wxDefaultValidator,
  32. const wxString& name = wxRadioButtonNameStr);
  33. virtual void SetValue(bool val);
  34. virtual bool GetValue() const ;
  35. void Command(wxCommandEvent& event);
  36. // Implementation
  37. virtual void ChangeBackgroundColour();
  38. // *this function is an implementation detail*
  39. // clears the selection in the radiobuttons in the cycle
  40. // and returns the old selection (if any)
  41. wxRadioButton* ClearSelections();
  42. protected:
  43. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  44. private:
  45. wxRadioButton* AddInCycle(wxRadioButton* cycle);
  46. void RemoveFromCycle();
  47. wxRadioButton* NextInCycle() { return m_cycle; }
  48. wxRadioButton *m_cycle;
  49. };
  50. #endif
  51. // _WX_RADIOBUT_H_