]>
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 | |
bfc6fde4 | 49 | ~wxRadioBox(); |
6b0d8a01 | 50 | |
bfc6fde4 | 51 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, |
3bdb8629 MB |
52 | const wxPoint& pos = wxDefaultPosition, |
53 | const wxSize& size = wxDefaultSize, | |
54 | int n = 0, const wxString choices[] = NULL, | |
55 | int majorDim = 0, long style = wxRA_HORIZONTAL, | |
56 | const wxValidator& val = wxDefaultValidator, | |
57 | const wxString& name = wxRadioBoxNameStr); | |
6b0d8a01 | 58 | |
bfc6fde4 VZ |
59 | int FindString(const wxString& s) const; |
60 | void SetSelection(int N); | |
61 | int GetSelection() const; | |
6b0d8a01 | 62 | |
18128cbb MB |
63 | void SetString(int item, const wxString& label) ; |
64 | wxString GetString(int item) const; | |
6b0d8a01 | 65 | virtual bool Enable(bool enable = TRUE); |
bfc6fde4 VZ |
66 | void Enable(int item, bool enable); |
67 | void Show(int item, bool show) ; | |
6b0d8a01 VZ |
68 | virtual bool Show(bool show = TRUE) ; |
69 | ||
bfc6fde4 VZ |
70 | virtual wxString GetStringSelection() const; |
71 | virtual bool SetStringSelection(const wxString& s); | |
3c85ada9 | 72 | virtual int GetCount() const { return m_noItems; } ; |
bfc6fde4 | 73 | void Command(wxCommandEvent& event); |
6b0d8a01 | 74 | |
18128cbb MB |
75 | int GetColumnCount() const; |
76 | int GetRowCount() const; | |
77 | ||
bfc6fde4 VZ |
78 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } |
79 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
6b0d8a01 | 80 | |
bfc6fde4 VZ |
81 | // Implementation |
82 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
83 | virtual void ChangeBackgroundColour(); | |
84 | virtual void ChangeForegroundColour(); | |
3bdb8629 | 85 | const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } |
3dd709d8 MB |
86 | void SetSel(int i) { m_selectedButton = i; } |
87 | virtual WXWidget GetLabelWidget() const { return m_labelWidget; } | |
6b0d8a01 | 88 | |
3bdb8629 MB |
89 | private: |
90 | void Init(); | |
91 | ||
9b6dbb09 | 92 | protected: |
2ad99bc1 | 93 | int m_majorDim; |
bfc6fde4 VZ |
94 | int m_noItems; |
95 | int m_noRowsOrCols; | |
96 | int m_selectedButton; | |
6b0d8a01 | 97 | |
3bdb8629 | 98 | wxWidgetArray m_radioButtons; |
3dd709d8 | 99 | WXWidget m_labelWidget; |
3bdb8629 | 100 | wxArrayString m_radioButtonLabels; |
6b0d8a01 | 101 | |
bfc6fde4 | 102 | virtual void DoSetSize(int x, int y, |
83df96d6 JS |
103 | int width, int height, |
104 | int sizeFlags = wxSIZE_AUTO); | |
9b6dbb09 JS |
105 | }; |
106 | ||
107 | #endif | |
83df96d6 | 108 | // _WX_RADIOBOX_H_ |