]>
Commit | Line | Data |
---|---|---|
89c684ef | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/valgen.h |
89c684ef JS |
3 | // Purpose: wxGenericValidator class |
4 | // Author: Kevin Smith | |
89c684ef | 5 | // Created: Jan 22 1999 |
99d80019 | 6 | // Copyright: (c) 1999 Julian Smart (assigned from Kevin) |
65571936 | 7 | // Licence: wxWindows licence |
89c684ef JS |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | #ifndef _WX_VALGENH__ | |
11 | #define _WX_VALGENH__ | |
12 | ||
89c684ef JS |
13 | #include "wx/validate.h" |
14 | ||
ce4169a4 RR |
15 | #if wxUSE_VALIDATORS |
16 | ||
22de6a40 | 17 | class WXDLLIMPEXP_FWD_BASE wxDateTime; |
e96be167 | 18 | class WXDLLIMPEXP_FWD_BASE wxFileName; |
22de6a40 | 19 | |
c699b458 VZ |
20 | // ---------------------------------------------------------------------------- |
21 | // wxGenericValidator performs data transfer between many standard controls and | |
22 | // variables of the type corresponding to their values. | |
23 | // | |
24 | // It doesn't do any validation so its name is a slight misnomer. | |
25 | // ---------------------------------------------------------------------------- | |
26 | ||
53a2db12 | 27 | class WXDLLIMPEXP_CORE wxGenericValidator: public wxValidator |
89c684ef JS |
28 | { |
29 | public: | |
c699b458 VZ |
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); | |
22de6a40 | 41 | #if wxUSE_DATETIME |
c699b458 VZ |
42 | // wxDatePickerCtrl |
43 | wxGenericValidator(wxDateTime* val); | |
22de6a40 | 44 | #endif // wxUSE_DATETIME |
e96be167 VZ |
45 | // wxTextCtrl |
46 | wxGenericValidator(wxFileName* val); | |
47 | // wxTextCtrl | |
48 | wxGenericValidator(float* val); | |
49 | // wxTextCtrl | |
50 | wxGenericValidator(double* val); | |
51 | ||
c699b458 | 52 | wxGenericValidator(const wxGenericValidator& copyFrom); |
89c684ef | 53 | |
c699b458 | 54 | virtual ~wxGenericValidator(){} |
89c684ef | 55 | |
c699b458 VZ |
56 | // Make a clone of this validator (or return NULL) - currently necessary |
57 | // if you're passing a reference to a validator. | |
58 | // Another possibility is to always pass a pointer to a new validator | |
59 | // (so the calling code can use a copy constructor of the relevant class). | |
60 | virtual wxObject *Clone() const { return new wxGenericValidator(*this); } | |
61 | bool Copy(const wxGenericValidator& val); | |
89c684ef | 62 | |
c699b458 VZ |
63 | // Called when the value in the window must be validated: this is not used |
64 | // by this class | |
65 | virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } | |
89c684ef | 66 | |
c699b458 VZ |
67 | // Called to transfer data to the window |
68 | virtual bool TransferToWindow(); | |
89c684ef | 69 | |
c699b458 VZ |
70 | // Called to transfer data to the window |
71 | virtual bool TransferFromWindow(); | |
89c684ef JS |
72 | |
73 | protected: | |
c699b458 | 74 | void Initialize(); |
89c684ef | 75 | |
c699b458 VZ |
76 | bool* m_pBool; |
77 | int* m_pInt; | |
78 | wxString* m_pString; | |
79 | wxArrayInt* m_pArrayInt; | |
22de6a40 | 80 | #if wxUSE_DATETIME |
c699b458 | 81 | wxDateTime* m_pDateTime; |
22de6a40 | 82 | #endif // wxUSE_DATETIME |
e96be167 VZ |
83 | wxFileName* m_pFileName; |
84 | float* m_pFloat; | |
85 | double* m_pDouble; | |
22f3361e VZ |
86 | |
87 | private: | |
c699b458 | 88 | DECLARE_CLASS(wxGenericValidator) |
c0c133e1 | 89 | wxDECLARE_NO_ASSIGN_CLASS(wxGenericValidator); |
89c684ef JS |
90 | }; |
91 | ||
c699b458 | 92 | #endif // wxUSE_VALIDATORS |
ce4169a4 | 93 | |
c699b458 | 94 | #endif // _WX_VALGENH__ |