]> git.saurik.com Git - wxWidgets.git/blame - src/common/valgen.cpp
Forgot header with OSX prefix
[wxWidgets.git] / src / common / valgen.cpp
CommitLineData
89c684ef 1/////////////////////////////////////////////////////////////////////////////
40ff126a 2// Name: src/common/valgen.cpp
89c684ef
JS
3// Purpose: wxGenericValidator class
4// Author: Kevin Smith
5// Modified by:
6// Created: Jan 22 1999
7448de8d 7// RCS-ID: $Id$
89c684ef 8// Copyright: (c) 1999 Kevin Smith
7448de8d 9// Licence: wxWindows licence
89c684ef
JS
10/////////////////////////////////////////////////////////////////////////////
11
89c684ef
JS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
8898456d 16 #pragma hdrstop
ce4169a4
RR
17#endif
18
19#if wxUSE_VALIDATORS
20
21#ifndef WX_PRECOMP
ad9835c9 22 #include "wx/dynarray.h"
8898456d
WS
23 #include "wx/utils.h"
24 #include "wx/intl.h"
8898456d
WS
25 #include "wx/choice.h"
26 #include "wx/combobox.h"
27 #include "wx/radiobox.h"
28 #include "wx/radiobut.h"
29 #include "wx/checkbox.h"
30 #include "wx/scrolbar.h"
31 #include "wx/gauge.h"
32 #include "wx/stattext.h"
33 #include "wx/textctrl.h"
34 #include "wx/button.h"
35 #include "wx/listbox.h"
36 #include "wx/slider.h"
e6e83933 37 #include "wx/checklst.h"
89c684ef
JS
38#endif
39
388aa6e2 40#include "wx/spinctrl.h"
22de6a40 41#include "wx/datectrl.h"
4ded51f2 42
cab1a605 43#if wxUSE_SPINBTN
ad9835c9 44 #include "wx/spinbutt.h"
750b78ba 45#endif
388aa6e2 46#if wxUSE_TOGGLEBTN
ad9835c9 47 #include "wx/tglbtn.h"
388aa6e2 48#endif
89c684ef
JS
49
50#include "wx/valgen.h"
51
5cf69f76
JS
52IMPLEMENT_CLASS(wxGenericValidator, wxValidator)
53
89c684ef
JS
54wxGenericValidator::wxGenericValidator(bool *val)
55{
ce4169a4
RR
56 Initialize();
57 m_pBool = val;
89c684ef
JS
58}
59
60wxGenericValidator::wxGenericValidator(int *val)
61{
ce4169a4
RR
62 Initialize();
63 m_pInt = val;
89c684ef
JS
64}
65
66wxGenericValidator::wxGenericValidator(wxString *val)
67{
ce4169a4
RR
68 Initialize();
69 m_pString = val;
89c684ef
JS
70}
71
72wxGenericValidator::wxGenericValidator(wxArrayInt *val)
73{
ce4169a4
RR
74 Initialize();
75 m_pArrayInt = val;
89c684ef
JS
76}
77
22de6a40
VZ
78#if wxUSE_DATETIME
79
80wxGenericValidator::wxGenericValidator(wxDateTime *val)
81{
82 Initialize();
83 m_pDateTime = val;
84}
85
86#endif // wxUSE_DATETIME
87
89c684ef 88wxGenericValidator::wxGenericValidator(const wxGenericValidator& val)
d84afea9 89 : wxValidator()
89c684ef 90{
ce4169a4 91 Copy(val);
89c684ef
JS
92}
93
94bool wxGenericValidator::Copy(const wxGenericValidator& val)
95{
e90196a5 96 wxValidator::Copy(val);
89c684ef 97
e90196a5
RR
98 m_pBool = val.m_pBool;
99 m_pInt = val.m_pInt;
100 m_pString = val.m_pString;
101 m_pArrayInt = val.m_pArrayInt;
22de6a40
VZ
102#if wxUSE_DATETIME
103 m_pDateTime = val.m_pDateTime;
104#endif // wxUSE_DATETIME
89c684ef 105
cab1a605 106 return true;
89c684ef
JS
107}
108
89c684ef
JS
109// Called to transfer data to the window
110bool wxGenericValidator::TransferToWindow(void)
111{
e90196a5 112 if ( !m_validatorWindow )
cab1a605 113 return false;
89c684ef 114
e90196a5 115 // bool controls
dcf924a3 116#if wxUSE_CHECKBOX
e90196a5 117 if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
89c684ef 118 {
e90196a5
RR
119 wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
120 if (m_pBool)
3ca6a5f0
BP
121 {
122 pControl->SetValue(*m_pBool);
cab1a605 123 return true;
3ca6a5f0 124 }
e90196a5 125 } else
dcf924a3
RR
126#endif
127#if wxUSE_RADIOBTN
e90196a5 128 if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
89c684ef 129 {
e90196a5 130 wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
3ca6a5f0
BP
131 if (m_pBool)
132 {
133 pControl->SetValue(*m_pBool) ;
cab1a605 134 return true;
3ca6a5f0 135 }
e90196a5 136 } else
dcf924a3 137#endif
10ff9c61 138
388aa6e2
JS
139#if wxUSE_TOGGLEBTN
140 if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
141 {
142 wxToggleButton * pControl = (wxToggleButton *) m_validatorWindow;
40ff126a
WS
143 if (m_pBool)
144 {
145 pControl->SetValue(*m_pBool);
146 return true;
147 }
388aa6e2 148 } else
b22bb1a0 149#if (defined(__WXMAC__) || defined(__WXGTK20__)) && !defined(__WXUNIVERSAL__)
10ff9c61
RR
150 if (m_validatorWindow->IsKindOf(CLASSINFO(wxBitmapToggleButton)) )
151 {
152 wxBitmapToggleButton * pControl = (wxBitmapToggleButton *) m_validatorWindow;
153 if (m_pBool)
154 {
155 pControl->SetValue(*m_pBool);
156 return true;
157 }
158 } else
159#endif
388aa6e2 160#endif
e90196a5
RR
161
162 // int controls
dcf924a3 163#if wxUSE_GAUGE
e90196a5 164 if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
89c684ef 165 {
e90196a5 166 wxGauge* pControl = (wxGauge*) m_validatorWindow;
3ca6a5f0
BP
167 if (m_pInt)
168 {
169 pControl->SetValue(*m_pInt);
cab1a605 170 return true;
3ca6a5f0 171 }
e90196a5 172 } else
dcf924a3
RR
173#endif
174#if wxUSE_RADIOBOX
e90196a5 175 if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
89c684ef 176 {
e90196a5 177 wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
3ca6a5f0
BP
178 if (m_pInt)
179 {
180 pControl->SetSelection(*m_pInt) ;
cab1a605 181 return true;
3ca6a5f0 182 }
e90196a5 183 } else
dcf924a3
RR
184#endif
185#if wxUSE_SCROLLBAR
e90196a5 186 if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
89c684ef 187 {
e90196a5 188 wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
3ca6a5f0
BP
189 if (m_pInt)
190 {
191 pControl->SetThumbPosition(*m_pInt) ;
cab1a605 192 return true;
3ca6a5f0 193 }
e90196a5 194 } else
dcf924a3 195#endif
3a5bcc4d 196#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
a55e0ebc
JS
197 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
198 {
199 wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
200 if (m_pInt)
201 {
202 pControl->SetValue(*m_pInt);
cab1a605 203 return true;
a55e0ebc
JS
204 }
205 } else
206#endif
3a5bcc4d 207#if wxUSE_SPINBTN
e90196a5 208 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
89c684ef 209 {
e90196a5 210 wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
3ca6a5f0
BP
211 if (m_pInt)
212 {
213 pControl->SetValue(*m_pInt) ;
cab1a605 214 return true;
3ca6a5f0 215 }
e90196a5 216 } else
dcf924a3 217#endif
e90196a5
RR
218#if wxUSE_SLIDER
219 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
220 {
221 wxSlider* pControl = (wxSlider*) m_validatorWindow;
222 if (m_pInt)
223 {
3ca6a5f0 224 pControl->SetValue(*m_pInt) ;
cab1a605 225 return true;
3ca6a5f0 226 }
e90196a5
RR
227 } else
228#endif
229
22de6a40 230 // date time controls
3baef911 231#if 0 // wxUSE_DATEPICKCTRL -- temporary fix for shared build linking
22de6a40
VZ
232 if (m_validatorWindow->IsKindOf(CLASSINFO(wxDatePickerCtrl)) )
233 {
234 wxDatePickerCtrl* pControl = (wxDatePickerCtrl*) m_validatorWindow;
235 if (m_pDateTime)
236 {
237 pControl->SetValue(*m_pDateTime) ;
238 return true;
239 }
240 } else
241#endif
242
3ca6a5f0 243 // string controls
d7260478 244#if wxUSE_BUTTON
e90196a5 245 if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
89c684ef 246 {
e90196a5 247 wxButton* pControl = (wxButton*) m_validatorWindow;
3ca6a5f0
BP
248 if (m_pString)
249 {
250 pControl->SetLabel(*m_pString) ;
cab1a605 251 return true;
3ca6a5f0 252 }
e90196a5 253 } else
d7260478 254#endif
e90196a5
RR
255#if wxUSE_COMBOBOX
256 if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
89c684ef 257 {
e90196a5 258 wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
f6bcfd97
BP
259 if (m_pInt)
260 {
261 pControl->SetSelection(*m_pInt) ;
cab1a605 262 return true;
f6bcfd97
BP
263 }
264 else if (m_pString)
265 {
cab1a605 266 if (pControl->FindString(* m_pString) != wxNOT_FOUND)
f6bcfd97
BP
267 {
268 pControl->SetStringSelection(* m_pString);
269 }
780fb83c 270 if ((m_validatorWindow->GetWindowStyle() & wxCB_READONLY) == 0)
7cc3cec9
JS
271 {
272 pControl->SetValue(* m_pString);
273 }
cab1a605 274 return true;
f6bcfd97 275 }
e90196a5 276 } else
ce4169a4 277#endif
a55e0ebc
JS
278#if wxUSE_CHOICE
279 if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
f6bcfd97 280 {
a55e0ebc 281 wxChoice* pControl = (wxChoice*) m_validatorWindow;
f6bcfd97
BP
282 if (m_pInt)
283 {
284 pControl->SetSelection(*m_pInt) ;
cab1a605 285 return true;
f6bcfd97
BP
286 }
287 else if (m_pString)
288 {
cab1a605 289 if (pControl->FindString(* m_pString) != wxNOT_FOUND)
f6bcfd97
BP
290 {
291 pControl->SetStringSelection(* m_pString);
292 }
cab1a605 293 return true;
f6bcfd97
BP
294 }
295 } else
a55e0ebc 296#endif
001e76a9 297#if wxUSE_STATTEXT
e90196a5 298 if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
89c684ef 299 {
e90196a5 300 wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
f6bcfd97
BP
301 if (m_pString)
302 {
303 pControl->SetLabel(*m_pString) ;
cab1a605 304 return true;
f6bcfd97 305 }
3ca6a5f0 306 } else
001e76a9 307#endif
d7260478 308#if wxUSE_TEXTCTRL
e90196a5 309 if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
89c684ef 310 {
e90196a5 311 wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
f6bcfd97
BP
312 if (m_pString)
313 {
314 pControl->SetValue(*m_pString) ;
cab1a605 315 return true;
f6bcfd97
BP
316 }
317 else if (m_pInt)
318 {
319 wxString str;
66b3ec7f 320 str.Printf(wxT("%d"), *m_pInt);
f6bcfd97 321 pControl->SetValue(str);
cab1a605 322 return true;
f6bcfd97 323 }
e90196a5 324 } else
d7260478 325#endif
388aa6e2 326
1e6feb95 327 // array controls
3a5bcc4d 328#if wxUSE_CHECKLISTBOX
1e6feb95
VZ
329 // NOTE: wxCheckListBox is a wxListBox, so wxCheckListBox MUST come first:
330 if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
89c684ef 331 {
1e6feb95
VZ
332 wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
333 if (m_pArrayInt)
334 {
335 // clear all selections
336 size_t i,
337 count = pControl->GetCount();
338 for ( i = 0 ; i < count; i++ )
cab1a605 339 pControl->Check(i, false);
1e6feb95
VZ
340
341 // select each item in our array
342 count = m_pArrayInt->GetCount();
343 for ( i = 0 ; i < count; i++ )
344 pControl->Check(m_pArrayInt->Item(i));
345
cab1a605 346 return true;
1e6feb95 347 }
3ca6a5f0 348 else
cab1a605 349 return false;
1e6feb95 350 } else
750b78ba 351#endif
dcf924a3 352#if wxUSE_LISTBOX
e90196a5 353 if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
89c684ef 354 {
e90196a5 355 wxListBox* pControl = (wxListBox*) m_validatorWindow;
3ca6a5f0
BP
356 if (m_pArrayInt)
357 {
358 // clear all selections
1e6feb95
VZ
359 size_t i,
360 count = pControl->GetCount();
361 for ( i = 0 ; i < count; i++ )
3ca6a5f0 362 pControl->Deselect(i);
1e6feb95 363
3ca6a5f0 364 // select each item in our array
1e6feb95
VZ
365 count = m_pArrayInt->GetCount();
366 for ( i = 0 ; i < count; i++ )
367 pControl->SetSelection(m_pArrayInt->Item(i));
368
cab1a605 369 return true;
3ca6a5f0 370 }
e90196a5 371 } else
dcf924a3 372#endif
2a230426
PC
373 { // to match the last 'else' above
374 }
89c684ef
JS
375
376 // unrecognized control, or bad pointer
cab1a605 377 return false;
89c684ef
JS
378}
379
e90196a5 380// Called to transfer data from the window
89c684ef
JS
381bool wxGenericValidator::TransferFromWindow(void)
382{
7448de8d
WS
383 if ( !m_validatorWindow )
384 return false;
89c684ef 385
7448de8d 386 // BOOL CONTROLS **************************************
dcf924a3 387#if wxUSE_CHECKBOX
7448de8d 388 if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
89c684ef 389 {
7448de8d
WS
390 wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
391 if (m_pBool)
392 {
393 *m_pBool = pControl->GetValue() ;
394 return true;
395 }
396 } else
dcf924a3
RR
397#endif
398#if wxUSE_RADIOBTN
7448de8d 399 if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
89c684ef 400 {
7448de8d
WS
401 wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
402 if (m_pBool)
403 {
404 *m_pBool = pControl->GetValue() ;
405 return true;
406 }
407 } else
dcf924a3 408#endif
388aa6e2
JS
409#if wxUSE_TOGGLEBTN
410 if (m_validatorWindow->IsKindOf(CLASSINFO(wxToggleButton)) )
411 {
40ff126a
WS
412 wxToggleButton *pControl = (wxToggleButton *) m_validatorWindow;
413 if (m_pBool)
414 {
415 *m_pBool = pControl->GetValue() ;
416 return true;
417 }
388aa6e2
JS
418 } else
419#endif
7448de8d
WS
420
421 // INT CONTROLS ***************************************
dcf924a3 422#if wxUSE_GAUGE
7448de8d 423 if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
89c684ef 424 {
7448de8d
WS
425 wxGauge* pControl = (wxGauge*) m_validatorWindow;
426 if (m_pInt)
427 {
428 *m_pInt = pControl->GetValue() ;
429 return true;
430 }
431 } else
dcf924a3
RR
432#endif
433#if wxUSE_RADIOBOX
7448de8d 434 if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
89c684ef 435 {
7448de8d
WS
436 wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
437 if (m_pInt)
438 {
439 *m_pInt = pControl->GetSelection() ;
440 return true;
441 }
442 } else
dcf924a3
RR
443#endif
444#if wxUSE_SCROLLBAR
7448de8d 445 if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
89c684ef 446 {
7448de8d
WS
447 wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
448 if (m_pInt)
449 {
450 *m_pInt = pControl->GetThumbPosition() ;
451 return true;
452 }
453 } else
dcf924a3 454#endif
3a5bcc4d 455#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
a55e0ebc
JS
456 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
457 {
458 wxSpinCtrl* pControl = (wxSpinCtrl*) m_validatorWindow;
459 if (m_pInt)
460 {
461 *m_pInt=pControl->GetValue();
cab1a605 462 return true;
a55e0ebc
JS
463 }
464 } else
465#endif
3a5bcc4d 466#if wxUSE_SPINBTN
7448de8d 467 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
89c684ef 468 {
7448de8d
WS
469 wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
470 if (m_pInt)
471 {
472 *m_pInt = pControl->GetValue() ;
473 return true;
474 }
475 } else
dcf924a3 476#endif
e90196a5 477#if wxUSE_SLIDER
7448de8d 478 if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
e90196a5 479 {
7448de8d
WS
480 wxSlider* pControl = (wxSlider*) m_validatorWindow;
481 if (m_pInt)
482 {
483 *m_pInt = pControl->GetValue() ;
484 return true;
485 }
486 } else
750b78ba 487#endif
7448de8d 488
22de6a40 489 // DATE TIME CONTROLS ************************************
3baef911 490#if 0 // wxUSE_DATEPICKCTRL -- temporary fix for shared build linking
22de6a40
VZ
491 if (m_validatorWindow->IsKindOf(CLASSINFO(wxDatePickerCtrl)) )
492 {
493 wxDatePickerCtrl* pControl = (wxDatePickerCtrl*) m_validatorWindow;
494 if (m_pDateTime)
495 {
496 *m_pDateTime = pControl->GetValue() ;
497 return true;
498 }
499 } else
500#endif
501
7448de8d 502 // STRING CONTROLS ************************************
d7260478 503#if wxUSE_BUTTON
7448de8d 504 if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
89c684ef 505 {
7448de8d
WS
506 wxButton* pControl = (wxButton*) m_validatorWindow;
507 if (m_pString)
508 {
509 *m_pString = pControl->GetLabel() ;
510 return true;
511 }
512 } else
d7260478 513#endif
dcf924a3 514#if wxUSE_COMBOBOX
7448de8d 515 if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
f6bcfd97 516 {
7448de8d
WS
517 wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
518 if (m_pInt)
519 {
520 *m_pInt = pControl->GetSelection() ;
521 return true;
522 }
523 else if (m_pString)
524 {
525 if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
526 *m_pString = pControl->GetStringSelection();
527 else
528 *m_pString = pControl->GetValue();
529 return true;
530 }
531 } else
dcf924a3 532#endif
ce4169a4 533#if wxUSE_CHOICE
7448de8d 534 if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
f6bcfd97 535 {
7448de8d
WS
536 wxChoice* pControl = (wxChoice*) m_validatorWindow;
537 if (m_pInt)
538 {
539 *m_pInt = pControl->GetSelection() ;
540 return true;
541 }
542 else if (m_pString)
543 {
544 *m_pString = pControl->GetStringSelection();
545 return true;
546 }
547 } else
ce4169a4 548#endif
001e76a9 549#if wxUSE_STATTEXT
7448de8d 550 if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
89c684ef 551 {
7448de8d
WS
552 wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
553 if (m_pString)
554 {
555 *m_pString = pControl->GetLabel() ;
556 return true;
557 }
558 } else
001e76a9 559#endif
d7260478 560#if wxUSE_TEXTCTRL
7448de8d 561 if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
f6bcfd97 562 {
7448de8d
WS
563 wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
564 if (m_pString)
565 {
566 *m_pString = pControl->GetValue() ;
567 return true;
568 }
569 else if (m_pInt)
570 {
571 *m_pInt = wxAtoi(pControl->GetValue());
572 return true;
573 }
574 } else
d7260478 575#endif
7448de8d
WS
576
577 // ARRAY CONTROLS *************************************
e90196a5 578#if wxUSE_CHECKLISTBOX
7448de8d
WS
579 // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
580 if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
89c684ef 581 {
7448de8d
WS
582 wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
583 if (m_pArrayInt)
584 {
585 // clear our array
586 m_pArrayInt->Clear();
587
588 // add each selected item to our array
589 size_t i,
590 count = pControl->GetCount();
591 for ( i = 0; i < count; i++ )
592 {
593 if (pControl->IsChecked(i))
594 m_pArrayInt->Add(i);
595 }
596
597 return true;
598 }
599 else
600 return false;
601 } else
dcf924a3 602#endif
dcf924a3 603#if wxUSE_LISTBOX
7448de8d 604 if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
89c684ef 605 {
7448de8d
WS
606 wxListBox* pControl = (wxListBox*) m_validatorWindow;
607 if (m_pArrayInt)
608 {
609 // clear our array
610 m_pArrayInt->Clear();
1e6feb95 611
7448de8d
WS
612 // add each selected item to our array
613 size_t i,
614 count = pControl->GetCount();
615 for ( i = 0; i < count; i++ )
616 {
40ff126a 617 if (pControl->IsSelected(i))
7448de8d
WS
618 m_pArrayInt->Add(i);
619 }
1e6feb95 620
7448de8d
WS
621 return true;
622 }
623 } else
dcf924a3 624#endif
89c684ef 625
7448de8d
WS
626 // unrecognized control, or bad pointer
627 return false;
628
cab1a605 629 return false;
89c684ef
JS
630}
631
632/*
633 Called by constructors to initialize ALL data members
634*/
635void wxGenericValidator::Initialize()
636{
ce4169a4
RR
637 m_pBool = 0;
638 m_pInt = 0;
639 m_pString = 0;
640 m_pArrayInt = 0;
22de6a40
VZ
641#if wxUSE_DATETIME
642 m_pDateTime = 0;
643#endif // wxUSE_DATETIME
89c684ef
JS
644}
645
22de6a40 646#endif // wxUSE_VALIDATORS