radiobox.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/radiobox.h
  3. // Purpose: wxRadioBox class
  4. // Author: Stefan Csomor
  5. // Modified by:
  6. // Created: 1998-01-01
  7. // Copyright: (c) Stefan Csomor
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_RADIOBOX_H_
  11. #define _WX_RADIOBOX_H_
  12. // List box item
  13. class WXDLLIMPEXP_FWD_CORE wxBitmap ;
  14. class WXDLLIMPEXP_FWD_CORE wxRadioButton ;
  15. class WXDLLIMPEXP_CORE wxRadioBox: public wxControl, public wxRadioBoxBase
  16. {
  17. DECLARE_DYNAMIC_CLASS(wxRadioBox)
  18. public:
  19. // Constructors & destructor
  20. wxRadioBox();
  21. inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
  22. const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
  23. int n = 0, const wxString choices[] = NULL,
  24. int majorDim = 0, long style = wxRA_SPECIFY_COLS,
  25. const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
  26. {
  27. Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
  28. }
  29. inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
  30. const wxPoint& pos, const wxSize& size,
  31. const wxArrayString& choices,
  32. int majorDim = 0, long style = wxRA_SPECIFY_COLS,
  33. const wxValidator& val = wxDefaultValidator,
  34. const wxString& name = wxRadioBoxNameStr)
  35. {
  36. Create(parent, id, title, pos, size, choices,
  37. majorDim, style, val, name);
  38. }
  39. virtual ~wxRadioBox();
  40. bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
  41. const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
  42. int n = 0, const wxString choices[] = NULL,
  43. int majorDim = 0, long style = wxRA_SPECIFY_COLS,
  44. const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
  45. bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
  46. const wxPoint& pos, const wxSize& size,
  47. const wxArrayString& choices,
  48. int majorDim = 0, long style = wxRA_SPECIFY_COLS,
  49. const wxValidator& val = wxDefaultValidator,
  50. const wxString& name = wxRadioBoxNameStr);
  51. // Enabling
  52. virtual bool Enable(bool enable = true);
  53. virtual bool Enable(unsigned int item, bool enable = true);
  54. virtual bool IsItemEnabled(unsigned int item) const;
  55. // Showing
  56. virtual bool Show(bool show = true);
  57. virtual bool Show(unsigned int item, bool show = true);
  58. virtual bool IsItemShown(unsigned int item) const;
  59. // Specific functions (in wxWidgets2 reference)
  60. virtual void SetSelection(int item);
  61. virtual int GetSelection() const;
  62. virtual unsigned int GetCount() const { return m_noItems; }
  63. virtual wxString GetString(unsigned int item) const;
  64. virtual void SetString(unsigned int item, const wxString& label);
  65. virtual wxString GetLabel() const;
  66. virtual void SetLabel(const wxString& label) ;
  67. // protect native font of box
  68. virtual bool SetFont( const wxFont &font );
  69. // Other external functions
  70. void Command(wxCommandEvent& event);
  71. void SetFocus();
  72. // Other variable access functions
  73. inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
  74. inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
  75. void OnRadioButton( wxCommandEvent& event ) ;
  76. protected:
  77. // resolve ambiguity in base classes
  78. virtual wxBorder GetDefaultBorder() const { return wxRadioBoxBase::GetDefaultBorder(); }
  79. wxRadioButton *m_radioButtonCycle;
  80. unsigned int m_noItems;
  81. int m_noRowsOrCols;
  82. // Internal functions
  83. virtual wxSize DoGetBestSize() const ;
  84. virtual void DoSetSize(int x, int y,
  85. int width, int height,
  86. int sizeFlags = wxSIZE_AUTO);
  87. DECLARE_EVENT_TABLE()
  88. };
  89. #endif
  90. // _WX_RADIOBOX_H_