]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e2731512 | 2 | // Name: src/palmos/radiobox.cpp |
ffecfa5a | 3 | // Purpose: wxRadioBox implementation |
e2731512 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
a152561c | 5 | // Modified by: Wlodzimierz ABX Skiba - native wxRadioBox implementation |
ffecfa5a | 6 | // Created: 10/13/04 |
e2731512 | 7 | // RCS-ID: $Id$ |
a152561c | 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // =========================================================================== | |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "radiobox.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #if wxUSE_RADIOBOX | |
32 | ||
33 | #ifndef WX_PRECOMP | |
34 | #include "wx/bitmap.h" | |
35 | #include "wx/brush.h" | |
36 | #include "wx/radiobox.h" | |
37 | #include "wx/settings.h" | |
38 | #include "wx/log.h" | |
39 | #endif | |
40 | ||
ffecfa5a JS |
41 | #if wxUSE_TOOLTIPS |
42 | #include "wx/tooltip.h" | |
43 | #endif // wxUSE_TOOLTIPS | |
44 | ||
8be10866 WS |
45 | #include "wx/radiobut.h" |
46 | ||
ffecfa5a JS |
47 | // TODO: wxCONSTRUCTOR |
48 | #if 0 // wxUSE_EXTENDED_RTTI | |
49 | WX_DEFINE_FLAGS( wxRadioBoxStyle ) | |
50 | ||
51 | wxBEGIN_FLAGS( wxRadioBoxStyle ) | |
52 | // new style border flags, we put them first to | |
53 | // use them for streaming out | |
54 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
55 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
56 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
57 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
58 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
59 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
e2731512 | 60 | |
ffecfa5a JS |
61 | // old style border flags |
62 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
63 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
64 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
65 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
66 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
67 | wxFLAGS_MEMBER(wxBORDER) | |
68 | ||
69 | // standard window styles | |
70 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
71 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
72 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
73 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
74 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) | |
75 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
76 | wxFLAGS_MEMBER(wxVSCROLL) | |
77 | wxFLAGS_MEMBER(wxHSCROLL) | |
78 | ||
79 | wxFLAGS_MEMBER(wxRA_SPECIFY_COLS) | |
80 | wxFLAGS_MEMBER(wxRA_HORIZONTAL) | |
81 | wxFLAGS_MEMBER(wxRA_SPECIFY_ROWS) | |
82 | wxFLAGS_MEMBER(wxRA_VERTICAL) | |
83 | ||
84 | wxEND_FLAGS( wxRadioBoxStyle ) | |
85 | ||
86 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxRadioBox, wxControl,"wx/radiobox.h") | |
87 | ||
88 | wxBEGIN_PROPERTIES_TABLE(wxRadioBox) | |
89 | wxEVENT_PROPERTY( Select , wxEVT_COMMAND_RADIOBOX_SELECTED , wxCommandEvent ) | |
90 | wxPROPERTY_FLAGS( WindowStyle , wxRadioBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
91 | wxEND_PROPERTIES_TABLE() | |
92 | ||
93 | #else | |
94 | IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) | |
95 | #endif | |
96 | ||
97 | /* | |
98 | selection | |
99 | content | |
100 | label | |
101 | dimension | |
102 | item | |
103 | */ | |
104 | ||
ffecfa5a JS |
105 | // =========================================================================== |
106 | // implementation | |
107 | // =========================================================================== | |
108 | ||
109 | // --------------------------------------------------------------------------- | |
110 | // wxRadioBox | |
111 | // --------------------------------------------------------------------------- | |
112 | ||
113 | int wxRadioBox::GetCount() const | |
114 | { | |
115 | return 0; | |
116 | } | |
117 | ||
118 | int wxRadioBox::GetColumnCount() const | |
119 | { | |
120 | return 0; | |
121 | } | |
122 | ||
123 | int wxRadioBox::GetRowCount() const | |
124 | { | |
125 | return 0; | |
126 | } | |
127 | ||
128 | // returns the number of rows | |
129 | int wxRadioBox::GetNumVer() const | |
130 | { | |
131 | return 0; | |
132 | } | |
133 | ||
134 | // returns the number of columns | |
135 | int wxRadioBox::GetNumHor() const | |
136 | { | |
137 | return 0; | |
138 | } | |
139 | ||
ffecfa5a JS |
140 | // Radio box item |
141 | wxRadioBox::wxRadioBox() | |
142 | { | |
143 | } | |
144 | ||
145 | bool wxRadioBox::Create(wxWindow *parent, | |
146 | wxWindowID id, | |
147 | const wxString& title, | |
148 | const wxPoint& pos, | |
149 | const wxSize& size, | |
150 | int n, | |
151 | const wxString choices[], | |
152 | int majorDim, | |
153 | long style, | |
154 | const wxValidator& val, | |
155 | const wxString& name) | |
156 | { | |
8be10866 WS |
157 | // initialize members |
158 | m_majorDim = majorDim == 0 ? n : majorDim; | |
159 | ||
160 | if(!wxControl::Create(parent, id, pos, size, style, val, name)) | |
161 | return false; | |
162 | ||
163 | for(int i=0; i<n; i++) | |
164 | { | |
165 | wxRadioButton* rb = new wxRadioButton(); | |
166 | rb->SetGroup( id ); | |
167 | rb->Create( | |
168 | this, | |
169 | wxID_ANY, | |
170 | choices[n], | |
171 | pos, | |
172 | size, | |
173 | ( n == 0 ? wxRB_GROUP : 0 ) | | |
174 | ( style & wxRA_USE_CHECKBOX ) ? wxRB_USE_CHECKBOX : 0 | |
175 | ); | |
176 | } | |
177 | ||
178 | SetSize(size); | |
ffecfa5a JS |
179 | } |
180 | ||
181 | bool wxRadioBox::Create(wxWindow *parent, | |
182 | wxWindowID id, | |
183 | const wxString& title, | |
184 | const wxPoint& pos, | |
185 | const wxSize& size, | |
186 | const wxArrayString& choices, | |
187 | int majorDim, | |
188 | long style, | |
189 | const wxValidator& val, | |
190 | const wxString& name) | |
191 | { | |
8be10866 WS |
192 | wxCArrayString chs(choices); |
193 | ||
194 | return Create( parent, id, title, pos, size, chs.GetCount(), | |
195 | chs.GetStrings(), majorDim, style, val, name ); | |
ffecfa5a JS |
196 | } |
197 | ||
198 | wxRadioBox::~wxRadioBox() | |
199 | { | |
200 | } | |
201 | ||
202 | void wxRadioBox::SetString(int item, const wxString& label) | |
203 | { | |
204 | } | |
205 | ||
206 | void wxRadioBox::SetSelection(int N) | |
207 | { | |
208 | } | |
209 | ||
210 | // Get single selection, for single choice list items | |
211 | int wxRadioBox::GetSelection() const | |
212 | { | |
213 | return 0; | |
214 | } | |
215 | ||
216 | // Find string for position | |
217 | wxString wxRadioBox::GetString(int item) const | |
218 | { | |
219 | wxString ret; | |
e2731512 | 220 | |
ffecfa5a JS |
221 | return ret; |
222 | } | |
223 | ||
224 | // ---------------------------------------------------------------------------- | |
225 | // size calculations | |
226 | // ---------------------------------------------------------------------------- | |
227 | ||
228 | wxSize wxRadioBox::GetMaxButtonSize() const | |
229 | { | |
230 | return wxSize(0,0); | |
231 | } | |
232 | ||
233 | wxSize wxRadioBox::GetTotalButtonSize(const wxSize& sizeBtn) const | |
234 | { | |
235 | return wxSize(0,0); | |
236 | } | |
237 | ||
238 | wxSize wxRadioBox::DoGetBestSize() const | |
239 | { | |
240 | return wxSize(0,0); | |
241 | } | |
242 | ||
243 | // Restored old code. | |
244 | void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) | |
245 | { | |
246 | } | |
247 | ||
ffecfa5a JS |
248 | void wxRadioBox::SetFocus() |
249 | { | |
250 | } | |
251 | ||
252 | bool wxRadioBox::Show(bool show) | |
253 | { | |
254 | return false; | |
255 | } | |
256 | ||
257 | // Enable a specific button | |
258 | void wxRadioBox::Enable(int item, bool enable) | |
259 | { | |
260 | } | |
261 | ||
262 | // Enable all controls | |
263 | bool wxRadioBox::Enable(bool enable) | |
264 | { | |
265 | return false; | |
266 | } | |
267 | ||
268 | // Show a specific button | |
269 | void wxRadioBox::Show(int item, bool show) | |
270 | { | |
271 | } | |
272 | ||
ffecfa5a JS |
273 | void wxRadioBox::Command(wxCommandEvent & event) |
274 | { | |
275 | } | |
276 | ||
ffecfa5a JS |
277 | void wxRadioBox::SendNotificationEvent() |
278 | { | |
279 | } | |
280 | ||
281 | bool wxRadioBox::SetFont(const wxFont& font) | |
282 | { | |
283 | return false; | |
284 | } | |
285 | ||
ffecfa5a | 286 | #endif // wxUSE_RADIOBOX |