]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/motif/radiobox.h | |
3 | // Purpose: wxRadioBox class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // Copyright: (c) Julian Smart | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_MOTIF_RADIOBOX_H_ | |
12 | #define _WX_MOTIF_RADIOBOX_H_ | |
13 | ||
14 | #ifndef wxWIDGET_ARRAY_DEFINED | |
15 | #define wxWIDGET_ARRAY_DEFINED | |
16 | ||
17 | #include "wx/dynarray.h" | |
18 | WX_DEFINE_ARRAY_PTR(WXWidget, wxWidgetArray); | |
19 | #endif // wxWIDGET_ARRAY_DEFINED | |
20 | ||
21 | #include "wx/arrstr.h" | |
22 | ||
23 | class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase | |
24 | { | |
25 | public: | |
26 | wxRadioBox() { Init(); } | |
27 | ||
28 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, | |
29 | const wxPoint& pos = wxDefaultPosition, | |
30 | const wxSize& size = wxDefaultSize, | |
31 | int n = 0, const wxString choices[] = NULL, | |
32 | int majorDim = 0, long style = wxRA_SPECIFY_COLS, | |
33 | const wxValidator& val = wxDefaultValidator, | |
34 | const wxString& name = wxRadioBoxNameStr) | |
35 | { | |
36 | Init(); | |
37 | ||
38 | Create(parent, id, title, pos, size, n, choices, | |
39 | majorDim, style, val, name); | |
40 | } | |
41 | ||
42 | wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, | |
43 | const wxPoint& pos, | |
44 | const wxSize& size, | |
45 | const wxArrayString& choices, | |
46 | int majorDim = 0, long style = wxRA_SPECIFY_COLS, | |
47 | const wxValidator& val = wxDefaultValidator, | |
48 | const wxString& name = wxRadioBoxNameStr) | |
49 | { | |
50 | Init(); | |
51 | ||
52 | Create(parent, id, title, pos, size, choices, | |
53 | majorDim, style, val, name); | |
54 | } | |
55 | ||
56 | virtual ~wxRadioBox(); | |
57 | ||
58 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
59 | const wxPoint& pos = wxDefaultPosition, | |
60 | const wxSize& size = wxDefaultSize, | |
61 | int n = 0, const wxString choices[] = NULL, | |
62 | int majorDim = 0, long style = wxRA_SPECIFY_COLS, | |
63 | const wxValidator& val = wxDefaultValidator, | |
64 | const wxString& name = wxRadioBoxNameStr); | |
65 | ||
66 | bool Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
67 | const wxPoint& pos, | |
68 | const wxSize& size, | |
69 | const wxArrayString& choices, | |
70 | int majorDim = 0, long style = wxRA_SPECIFY_COLS, | |
71 | const wxValidator& val = wxDefaultValidator, | |
72 | const wxString& name = wxRadioBoxNameStr); | |
73 | ||
74 | // Enabling | |
75 | virtual bool Enable(bool enable = true); | |
76 | virtual bool Enable(unsigned int item, bool enable = true); | |
77 | virtual bool IsItemEnabled(unsigned int WXUNUSED(n)) const | |
78 | { | |
79 | /* TODO */ | |
80 | return true; | |
81 | } | |
82 | ||
83 | // Showing | |
84 | virtual bool Show(bool show = true); | |
85 | virtual bool Show(unsigned int item, bool show = true); | |
86 | virtual bool IsItemShown(unsigned int WXUNUSED(n)) const | |
87 | { | |
88 | /* TODO */ | |
89 | return true; | |
90 | } | |
91 | ||
92 | virtual void SetSelection(int n); | |
93 | int GetSelection() const; | |
94 | ||
95 | virtual void SetString(unsigned int item, const wxString& label); | |
96 | virtual wxString GetString(unsigned int item) const; | |
97 | ||
98 | virtual wxString GetStringSelection() const; | |
99 | virtual bool SetStringSelection(const wxString& s); | |
100 | virtual unsigned int GetCount() const { return m_noItems; } ; | |
101 | void Command(wxCommandEvent& event); | |
102 | ||
103 | int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; } | |
104 | void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; } | |
105 | ||
106 | // Implementation | |
107 | virtual void ChangeFont(bool keepOriginalSize = true); | |
108 | virtual void ChangeBackgroundColour(); | |
109 | virtual void ChangeForegroundColour(); | |
110 | const wxWidgetArray& GetRadioButtons() const { return m_radioButtons; } | |
111 | void SetSel(int i) { m_selectedButton = i; } | |
112 | virtual WXWidget GetLabelWidget() const { return m_labelWidget; } | |
113 | ||
114 | protected: | |
115 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
116 | virtual void DoSetSize(int x, int y, | |
117 | int width, int height, | |
118 | int sizeFlags = wxSIZE_AUTO); | |
119 | ||
120 | unsigned int m_noItems; | |
121 | int m_noRowsOrCols; | |
122 | int m_selectedButton; | |
123 | ||
124 | wxWidgetArray m_radioButtons; | |
125 | WXWidget m_labelWidget; | |
126 | wxArrayString m_radioButtonLabels; | |
127 | ||
128 | private: | |
129 | void Init(); | |
130 | ||
131 | DECLARE_DYNAMIC_CLASS(wxRadioBox) | |
132 | }; | |
133 | ||
134 | #endif // _WX_MOTIF_RADIOBOX_H_ |