1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxRadioBox class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_RADIOBOX_H_
13 #define _WX_RADIOBOX_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "radiobox.h"
19 #ifndef wxWIDGET_ARRAY_DEFINED
20 #define wxWIDGET_ARRAY_DEFINED
22 #include "wx/dynarray.h"
23 WX_DEFINE_ARRAY(WXWidget
, wxWidgetArray
);
26 #include "wx/arrstr.h"
28 class WXDLLEXPORT wxRadioBox
: public wxControl
, public wxRadioBoxBase
30 DECLARE_DYNAMIC_CLASS(wxRadioBox
)
33 wxRadioBox() { Init(); }
35 wxRadioBox(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
36 const wxPoint
& pos
= wxDefaultPosition
,
37 const wxSize
& size
= wxDefaultSize
,
38 int n
= 0, const wxString choices
[] = NULL
,
39 int majorDim
= 0, long style
= wxRA_HORIZONTAL
,
40 const wxValidator
& val
= wxDefaultValidator
,
41 const wxString
& name
= wxRadioBoxNameStr
)
45 Create(parent
, id
, title
, pos
, size
, n
, choices
,
46 majorDim
, style
, val
, name
);
49 wxRadioBox(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
52 const wxArrayString
& choices
,
53 int majorDim
= 0, long style
= wxRA_HORIZONTAL
,
54 const wxValidator
& val
= wxDefaultValidator
,
55 const wxString
& name
= wxRadioBoxNameStr
)
59 Create(parent
, id
, title
, pos
, size
, choices
,
60 majorDim
, style
, val
, name
);
65 bool Create(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
66 const wxPoint
& pos
= wxDefaultPosition
,
67 const wxSize
& size
= wxDefaultSize
,
68 int n
= 0, const wxString choices
[] = NULL
,
69 int majorDim
= 0, long style
= wxRA_HORIZONTAL
,
70 const wxValidator
& val
= wxDefaultValidator
,
71 const wxString
& name
= wxRadioBoxNameStr
);
73 bool Create(wxWindow
*parent
, wxWindowID id
, const wxString
& title
,
76 const wxArrayString
& choices
,
77 int majorDim
= 0, long style
= wxRA_HORIZONTAL
,
78 const wxValidator
& val
= wxDefaultValidator
,
79 const wxString
& name
= wxRadioBoxNameStr
);
81 int FindString(const wxString
& s
) const;
82 void SetSelection(int N
);
83 int GetSelection() const;
85 void SetString(int item
, const wxString
& label
) ;
86 wxString
GetString(int item
) const;
87 virtual bool Enable(bool enable
= true);
88 void Enable(int item
, bool enable
);
89 void Show(int item
, bool show
) ;
90 virtual bool Show(bool show
= true) ;
92 virtual wxString
GetStringSelection() const;
93 virtual bool SetStringSelection(const wxString
& s
);
94 virtual int GetCount() const { return m_noItems
; } ;
95 void Command(wxCommandEvent
& event
);
97 int GetColumnCount() const;
98 int GetRowCount() const;
100 int GetNumberOfRowsOrCols() const { return m_noRowsOrCols
; }
101 void SetNumberOfRowsOrCols(int n
) { m_noRowsOrCols
= n
; }
104 virtual void ChangeFont(bool keepOriginalSize
= true);
105 virtual void ChangeBackgroundColour();
106 virtual void ChangeForegroundColour();
107 const wxWidgetArray
& GetRadioButtons() const { return m_radioButtons
; }
108 void SetSel(int i
) { m_selectedButton
= i
; }
109 virtual WXWidget
GetLabelWidget() const { return m_labelWidget
; }
118 int m_selectedButton
;
120 wxWidgetArray m_radioButtons
;
121 WXWidget m_labelWidget
;
122 wxArrayString m_radioButtonLabels
;
124 virtual void DoSetSize(int x
, int y
,
125 int width
, int height
,
126 int sizeFlags
= wxSIZE_AUTO
);