]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobox.h | |
3 | // Purpose: wxRadioBox class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
af0bb3b1 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_RADIOBOX_H_ | |
13 | #define _WX_RADIOBOX_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
9b6dbb09 JS |
16 | #pragma interface "radiobox.h" |
17 | #endif | |
18 | ||
3bdb8629 MB |
19 | #ifndef wxWIDGET_ARRAY_DEFINED |
20 | #define wxWIDGET_ARRAY_DEFINED | |
9b6dbb09 | 21 | |
3bdb8629 MB |
22 | #include "wx/dynarray.h" |
23 | WX_DEFINE_ARRAY(WXWidget, wxWidgetArray); | |
24 | #endif | |
25 | ||
26 | #include "wx/arrstr.h" | |
9b6dbb09 | 27 | |
18128cbb | 28 | class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase |
9b6dbb09 | 29 | { |
83df96d6 | 30 | DECLARE_DYNAMIC_CLASS(wxRadioBox) |
6b0d8a01 | 31 | |
9b6dbb09 | 32 | public: |
3bdb8629 | 33 | wxRadioBox() { Init(); } |
6b0d8a01 | 34 | |
bfc6fde4 | 35 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
3bdb8629 MB |
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) | |
bfc6fde4 | 42 | { |
3bdb8629 MB |
43 | Init(); |
44 | ||
45 | Create(parent, id, title, pos, size, n, choices, | |
46 | majorDim, style, val, name); | |
bfc6fde4 | 47 | } |
6b0d8a01 | 48 | |
584ad2a3 MB |
49 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, |
50 | const wxPoint& pos, | |
51 | const wxSize& size, | |
52 | const wxArrayString& choices, | |
53 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
54 | const wxValidator& val = wxDefaultValidator, | |
55 | const wxString& name = wxRadioBoxNameStr) | |
56 | { | |
57 | Init(); | |
58 | ||
59 | Create(parent, id, title, pos, size, choices, | |
60 | majorDim, style, val, name); | |
61 | } | |
62 | ||
bfc6fde4 | 63 | ~wxRadioBox(); |
6b0d8a01 | 64 | |
bfc6fde4 | 65 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
3bdb8629 MB |
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); | |
6b0d8a01 | 72 | |
584ad2a3 MB |
73 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
74 | const wxPoint& pos, | |
75 | const wxSize& size, | |
76 | const wxArrayString& choices, | |
77 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
78 | const wxValidator& val = wxDefaultValidator, | |
79 | const wxString& name = wxRadioBoxNameStr); | |
80 | ||
bfc6fde4 VZ |
81 | int FindString(const wxString& s) const; |
82 | void SetSelection(int N); | |
83 | int GetSelection() const; | |
6b0d8a01 | 84 | |
18128cbb MB |
85 | void SetString(int item, const wxString& label) ; |
86 | wxString GetString(int item) const; | |
6b0d8a01 | 87 | virtual bool Enable(bool enable = TRUE); |
bfc6fde4 VZ |
88 | void Enable(int item, bool enable); |
89 | void Show(int item, bool show) ; | |
6b0d8a01 VZ |
90 | virtual bool Show(bool show = TRUE) ; |
91 | ||
bfc6fde4 VZ |
92 | virtual wxString GetStringSelection() const; |
93 | virtual bool SetStringSelection(const wxString& s); | |
3c85ada9 | 94 | virtual int GetCount() const { return m_noItems; } ; |
bfc6fde4 | 95 | void Command(wxCommandEvent& event); |
6b0d8a01 | 96 | |
18128cbb MB |
97 | int GetColumnCount() const; |
98 | int GetRowCount() const; | |
99 | ||
bfc6fde4 VZ |
100 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } |
101 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
6b0d8a01 | 102 | |
bfc6fde4 VZ |
103 | // Implementation |
104 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
105 | virtual void ChangeBackgroundColour(); | |
106 | virtual void ChangeForegroundColour(); | |
3bdb8629 | 107 | const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } |
3dd709d8 MB |
108 | void SetSel(int i) { m_selectedButton = i; } |
109 | virtual WXWidget GetLabelWidget() const { return m_labelWidget; } | |
6b0d8a01 | 110 | |
3bdb8629 MB |
111 | private: |
112 | void Init(); | |
113 | ||
9b6dbb09 | 114 | protected: |
2ad99bc1 | 115 | int m_majorDim; |
bfc6fde4 VZ |
116 | int m_noItems; |
117 | int m_noRowsOrCols; | |
118 | int m_selectedButton; | |
6b0d8a01 | 119 | |
3bdb8629 | 120 | wxWidgetArray m_radioButtons; |
3dd709d8 | 121 | WXWidget m_labelWidget; |
3bdb8629 | 122 | wxArrayString m_radioButtonLabels; |
6b0d8a01 | 123 | |
bfc6fde4 | 124 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
125 | int width, int height, |
126 | int sizeFlags = wxSIZE_AUTO); | |
9b6dbb09 JS |
127 | }; |
128 | ||
129 | #endif | |
83df96d6 | 130 | // _WX_RADIOBOX_H_ |