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
;
20 // ----------------------------------------------------------------------------
21 // wxGenericValidator performs data transfer between many standard controls and
22 // variables of the type corresponding to their values.
24 // It doesn't do any validation so its name is a slight misnomer.
25 // ----------------------------------------------------------------------------
27 class WXDLLIMPEXP_CORE wxGenericValidator
: public wxValidator
30 // Different constructors: each of them creates a validator which can only
31 // be used with some controls, the comments before each constructor
32 // indicate which ones:
33 // wxCheckBox, wxRadioButton, wx(Bitmap)ToggleButton
34 wxGenericValidator(bool* val
);
35 // wxChoice, wxGauge, wxRadioBox, wxScrollBar, wxSlider, wxSpinButton
36 wxGenericValidator(int* val
);
37 // wxComboBox, wxTextCtrl, wxButton, wxStaticText (read-only)
38 wxGenericValidator(wxString
* val
);
39 // wxListBox, wxCheckListBox
40 wxGenericValidator(wxArrayInt
* val
);
43 wxGenericValidator(wxDateTime
* val
);
44 #endif // wxUSE_DATETIME
45 wxGenericValidator(const wxGenericValidator
& copyFrom
);
47 virtual ~wxGenericValidator(){}
49 // Make a clone of this validator (or return NULL) - currently necessary
50 // if you're passing a reference to a validator.
51 // Another possibility is to always pass a pointer to a new validator
52 // (so the calling code can use a copy constructor of the relevant class).
53 virtual wxObject
*Clone() const { return new wxGenericValidator(*this); }
54 bool Copy(const wxGenericValidator
& val
);
56 // Called when the value in the window must be validated: this is not used
58 virtual bool Validate(wxWindow
* WXUNUSED(parent
)) { return true; }
60 // Called to transfer data to the window
61 virtual bool TransferToWindow();
63 // Called to transfer data to the window
64 virtual bool TransferFromWindow();
72 wxArrayInt
* m_pArrayInt
;
74 wxDateTime
* m_pDateTime
;
75 #endif // wxUSE_DATETIME
78 DECLARE_CLASS(wxGenericValidator
)
79 wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator
);
82 #endif // wxUSE_VALIDATORS
84 #endif // _WX_VALGENH__