]>
Commit | Line | Data |
---|---|---|
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_RADIOBOX_H_ | |
13 | #define _WX_RADIOBOX_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "radiobox.h" | |
17 | #endif | |
18 | ||
19 | #ifndef wxWIDGET_ARRAY_DEFINED | |
20 | #define wxWIDGET_ARRAY_DEFINED | |
21 | ||
22 | #include "wx/dynarray.h" | |
23 | WX_DEFINE_ARRAY(WXWidget, wxWidgetArray); | |
24 | #endif | |
25 | ||
26 | #include "wx/arrstr.h" | |
27 | ||
28 | class WXDLLEXPORT wxRadioBox : public wxControl, public wxRadioBoxBase | |
29 | { | |
30 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
31 | ||
32 | public: | |
33 | wxRadioBox() { Init(); } | |
34 | ||
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) | |
42 | { | |
43 | Init(); | |
44 | ||
45 | Create(parent, id, title, pos, size, n, choices, | |
46 | majorDim, style, val, name); | |
47 | } | |
48 | ||
49 | ~wxRadioBox(); | |
50 | ||
51 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
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); | |
58 | ||
59 | int FindString(const wxString& s) const; | |
60 | void SetSelection(int N); | |
61 | int GetSelection() const; | |
62 | ||
63 | void SetString(int item, const wxString& label) ; | |
64 | wxString GetString(int item) const; | |
65 | virtual bool Enable(bool enable = TRUE); | |
66 | void Enable(int item, bool enable); | |
67 | void Show(int item, bool show) ; | |
68 | virtual bool Show(bool show = TRUE) ; | |
69 | ||
70 | virtual wxString GetStringSelection() const; | |
71 | virtual bool SetStringSelection(const wxString& s); | |
72 | virtual int GetCount() const { return m_noItems; } ; | |
73 | void Command(wxCommandEvent& event); | |
74 | ||
75 | int GetColumnCount() const; | |
76 | int GetRowCount() const; | |
77 | ||
78 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
79 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
80 | ||
81 | // Implementation | |
82 | virtual void ChangeFont(bool keepOriginalSize = TRUE); | |
83 | virtual void ChangeBackgroundColour(); | |
84 | virtual void ChangeForegroundColour(); | |
85 | const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } | |
86 | void SetSel(int i) { m_selectedButton = i; } | |
87 | virtual WXWidget GetLabelWidget() const { return m_labelWidget; } | |
88 | ||
89 | private: | |
90 | void Init(); | |
91 | ||
92 | protected: | |
93 | int m_majorDim; | |
94 | int m_noItems; | |
95 | int m_noRowsOrCols; | |
96 | int m_selectedButton; | |
97 | ||
98 | wxWidgetArray m_radioButtons; | |
99 | WXWidget m_labelWidget; | |
100 | wxArrayString m_radioButtonLabels; | |
101 | ||
102 | virtual void DoSetSize(int x, int y, | |
103 | int width, int height, | |
104 | int sizeFlags = wxSIZE_AUTO); | |
105 | }; | |
106 | ||
107 | #endif | |
108 | // _WX_RADIOBOX_H_ |