1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGenericValidator class
5 // Created: Jan 22 1999
7 // Copyright: (c) 1999 Julian Smart (assigned from Kevin)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/validate.h"
18 class WXDLLIMPEXP_FWD_BASE wxDateTime
;
19 class WXDLLIMPEXP_FWD_BASE wxFileName
;
21 // ----------------------------------------------------------------------------
22 // wxGenericValidator performs data transfer between many standard controls and
23 // variables of the type corresponding to their values.
25 // It doesn't do any validation so its name is a slight misnomer.
26 // ----------------------------------------------------------------------------
28 class WXDLLIMPEXP_CORE wxGenericValidator
: public wxValidator
31 // Different constructors: each of them creates a validator which can only
32 // be used with some controls, the comments before each constructor
33 // indicate which ones:
34 // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton
35 wxGenericValidator(bool* val
);
36 // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton
37 wxGenericValidator(int* val
);
38 // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only)
39 wxGenericValidator(wxString
* val
);
40 // wxListBox, wxCheckListBox
41 wxGenericValidator(wxArrayInt
* val
);
44 wxGenericValidator(wxDateTime
* val
);
45 #endif // wxUSE_DATETIME
47 wxGenericValidator(wxFileName
* val
);
49 wxGenericValidator(float* val
);
51 wxGenericValidator(double* val
);
53 wxGenericValidator(const wxGenericValidator
& copyFrom
);
55 virtual ~wxGenericValidator(){}
57 // Make a clone of this validator (or return NULL) - currently necessary
58 // if you're passing a reference to a validator.
59 // Another possibility is to always pass a pointer to a new validator
60 // (so the calling code can use a copy constructor of the relevant class).
61 virtual wxObject
*Clone() const { return new wxGenericValidator(*this); }
62 bool Copy(const wxGenericValidator
& val
);
64 // Called when the value in the window must be validated: this is not used
66 virtual bool Validate(wxWindow
* WXUNUSED(parent
)) { return true; }
68 // Called to transfer data to the window
69 virtual bool TransferToWindow();
71 // Called to transfer data to the window
72 virtual bool TransferFromWindow();
80 wxArrayInt
* m_pArrayInt
;
82 wxDateTime
* m_pDateTime
;
83 #endif // wxUSE_DATETIME
84 wxFileName
* m_pFileName
;
89 DECLARE_CLASS(wxGenericValidator
)
90 wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator
);
93 #endif // wxUSE_VALIDATORS
95 #endif // _WX_VALGENH__