]>
Commit | Line | Data |
---|---|---|
7c78e7c7 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: radiobox.cpp | |
01b2eeec KB |
3 | // Purpose: wxRadioBox |
4 | // Author: AUTHOR | |
5 | // Modified by: | |
6 | // Created: ??/??/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) AUTHOR | |
7c78e7c7 RR |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
7c78e7c7 RR |
12 | #ifdef __GNUG__ |
13 | #pragma implementation "radiobox.h" | |
14 | #endif | |
15 | ||
16 | #include "wx/radiobox.h" | |
7c78e7c7 | 17 | |
01b2eeec | 18 | IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) |
01b2eeec KB |
19 | |
20 | // Radio box item | |
21 | wxRadioBox::wxRadioBox() | |
22 | { | |
23 | m_selectedButton = -1; | |
24 | m_noItems = 0; | |
25 | m_noRowsOrCols = 0; | |
26 | m_majorDim = 0 ; | |
27 | } | |
28 | ||
29 | bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, | |
30 | const wxPoint& pos, const wxSize& size, | |
31 | int n, const wxString choices[], | |
32 | int majorDim, long style, | |
33 | const wxValidator& val, const wxString& name) | |
34 | { | |
35 | m_selectedButton = -1; | |
36 | m_noItems = n; | |
37 | ||
38 | SetName(name); | |
39 | SetValidator(val); | |
7c78e7c7 | 40 | |
01b2eeec | 41 | parent->AddChild(this); |
7c78e7c7 | 42 | |
01b2eeec | 43 | m_windowStyle = (long&)style; |
7c78e7c7 | 44 | |
01b2eeec KB |
45 | if (id == -1) |
46 | m_windowId = NewControlId(); | |
47 | else | |
48 | m_windowId = id; | |
7c78e7c7 | 49 | |
01b2eeec | 50 | m_noRowsOrCols = majorDim; |
7c78e7c7 | 51 | |
01b2eeec KB |
52 | if (majorDim==0) |
53 | m_majorDim = n ; | |
54 | else | |
55 | m_majorDim = majorDim ; | |
56 | ||
57 | ||
58 | // TODO create radiobox | |
59 | return FALSE; | |
60 | } | |
61 | ||
62 | ||
63 | wxRadioBox::~wxRadioBox() | |
7c78e7c7 | 64 | { |
01b2eeec KB |
65 | // TODO |
66 | } | |
7c78e7c7 | 67 | |
01b2eeec | 68 | wxString wxRadioBox::GetLabel(int item) const |
7c78e7c7 | 69 | { |
01b2eeec KB |
70 | // TODO |
71 | return wxString(""); | |
72 | } | |
7c78e7c7 | 73 | |
01b2eeec | 74 | void wxRadioBox::SetLabel(int item, const wxString& label) |
7c78e7c7 | 75 | { |
01b2eeec KB |
76 | // TODO |
77 | } | |
7c78e7c7 | 78 | |
01b2eeec | 79 | int wxRadioBox::FindString(const wxString& s) const |
7c78e7c7 | 80 | { |
01b2eeec KB |
81 | // TODO |
82 | return -1; | |
83 | } | |
7c78e7c7 | 84 | |
01b2eeec | 85 | void wxRadioBox::SetSelection(int n) |
7c78e7c7 | 86 | { |
01b2eeec KB |
87 | if ((n < 0) || (n >= m_noItems)) |
88 | return; | |
89 | // TODO | |
7c78e7c7 | 90 | |
01b2eeec KB |
91 | m_selectedButton = n; |
92 | } | |
93 | ||
94 | // Get single selection, for single choice list items | |
95 | int wxRadioBox::GetSelection() const | |
7c78e7c7 | 96 | { |
01b2eeec KB |
97 | return m_selectedButton; |
98 | } | |
7c78e7c7 | 99 | |
01b2eeec KB |
100 | // Find string for position |
101 | wxString wxRadioBox::GetString(int n) const | |
7c78e7c7 | 102 | { |
01b2eeec KB |
103 | // TODO |
104 | return wxString(""); | |
105 | } | |
7c78e7c7 | 106 | |
01b2eeec | 107 | void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) |
7c78e7c7 | 108 | { |
01b2eeec KB |
109 | // TODO |
110 | } | |
7c78e7c7 | 111 | |
01b2eeec | 112 | void wxRadioBox::GetSize(int *width, int *height) const |
7c78e7c7 | 113 | { |
01b2eeec KB |
114 | // TODO |
115 | } | |
7c78e7c7 | 116 | |
01b2eeec | 117 | void wxRadioBox::GetPosition(int *x, int *y) const |
7c78e7c7 | 118 | { |
01b2eeec KB |
119 | // TODO |
120 | } | |
7c78e7c7 | 121 | |
01b2eeec | 122 | wxString wxRadioBox::GetLabel() const |
7c78e7c7 | 123 | { |
01b2eeec KB |
124 | // TODO |
125 | return wxString(""); | |
126 | } | |
7c78e7c7 | 127 | |
01b2eeec | 128 | void wxRadioBox::SetLabel(const wxString& label) |
7c78e7c7 | 129 | { |
01b2eeec KB |
130 | // TODO |
131 | } | |
7c78e7c7 | 132 | |
01b2eeec | 133 | void wxRadioBox::SetFocus() |
7c78e7c7 | 134 | { |
01b2eeec KB |
135 | // TODO |
136 | } | |
7c78e7c7 | 137 | |
01b2eeec | 138 | bool wxRadioBox::Show(bool show) |
7c78e7c7 | 139 | { |
01b2eeec KB |
140 | // TODO |
141 | return FALSE; | |
142 | } | |
7c78e7c7 | 143 | |
01b2eeec KB |
144 | // Enable a specific button |
145 | void wxRadioBox::Enable(int item, bool enable) | |
7c78e7c7 | 146 | { |
01b2eeec KB |
147 | // TODO |
148 | } | |
7c78e7c7 | 149 | |
01b2eeec KB |
150 | // Enable all controls |
151 | void wxRadioBox::Enable(bool enable) | |
7c78e7c7 | 152 | { |
01b2eeec KB |
153 | wxControl::Enable(enable); |
154 | ||
155 | // TODO | |
156 | } | |
7c78e7c7 | 157 | |
01b2eeec KB |
158 | // Show a specific button |
159 | void wxRadioBox::Show(int item, bool show) | |
7c78e7c7 | 160 | { |
01b2eeec KB |
161 | // TODO |
162 | } | |
7c78e7c7 | 163 | |
01b2eeec KB |
164 | // For single selection items only |
165 | wxString wxRadioBox::GetStringSelection () const | |
7c78e7c7 | 166 | { |
01b2eeec KB |
167 | int sel = GetSelection (); |
168 | if (sel > -1) | |
169 | return this->GetString (sel); | |
170 | else | |
171 | return wxString(""); | |
172 | } | |
7c78e7c7 | 173 | |
01b2eeec | 174 | bool wxRadioBox::SetStringSelection (const wxString& s) |
7c78e7c7 | 175 | { |
01b2eeec KB |
176 | int sel = FindString (s); |
177 | if (sel > -1) | |
178 | { | |
179 | SetSelection (sel); | |
180 | return TRUE; | |
181 | } | |
182 | else | |
183 | return FALSE; | |
184 | } | |
7c78e7c7 | 185 | |
01b2eeec | 186 | void wxRadioBox::Command (wxCommandEvent & event) |
7c78e7c7 | 187 | { |
01b2eeec KB |
188 | SetSelection (event.m_commandInt); |
189 | ProcessCommand (event); | |
190 | } | |
191 | ||
7c78e7c7 | 192 |