]>
Commit | Line | Data |
---|---|---|
89c684ef JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: valgen.h | |
3 | // Purpose: wxGenericValidator class | |
4 | // Author: Kevin Smith | |
5 | // Modified by: | |
6 | // Created: Jan 22 1999 | |
ca298c88 | 7 | // RCS-ID: |
99d80019 | 8 | // Copyright: (c) 1999 Julian Smart (assigned from Kevin) |
65571936 | 9 | // Licence: wxWindows licence |
89c684ef JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_VALGENH__ | |
13 | #define _WX_VALGENH__ | |
14 | ||
89c684ef JS |
15 | #include "wx/validate.h" |
16 | ||
ce4169a4 RR |
17 | #if wxUSE_VALIDATORS |
18 | ||
89c684ef JS |
19 | class WXDLLEXPORT wxGenericValidator: public wxValidator |
20 | { | |
5cf69f76 | 21 | DECLARE_CLASS(wxGenericValidator) |
89c684ef JS |
22 | public: |
23 | wxGenericValidator(bool* val); | |
24 | wxGenericValidator(int* val); | |
25 | wxGenericValidator(wxString* val); | |
26 | wxGenericValidator(wxArrayInt* val); | |
27 | wxGenericValidator(const wxGenericValidator& copyFrom); | |
28 | ||
d3c7fc99 | 29 | virtual ~wxGenericValidator(){} |
89c684ef JS |
30 | |
31 | // Make a clone of this validator (or return NULL) - currently necessary | |
32 | // if you're passing a reference to a validator. | |
33 | // Another possibility is to always pass a pointer to a new validator | |
34 | // (so the calling code can use a copy constructor of the relevant class). | |
74e3313b | 35 | virtual wxObject *Clone() const { return new wxGenericValidator(*this); } |
89c684ef JS |
36 | bool Copy(const wxGenericValidator& val); |
37 | ||
38 | // Called when the value in the window must be validated. | |
39 | // This function can pop up an error message. | |
cab1a605 | 40 | virtual bool Validate(wxWindow * WXUNUSED(parent)) { return true; } |
89c684ef JS |
41 | |
42 | // Called to transfer data to the window | |
74e3313b | 43 | virtual bool TransferToWindow(); |
89c684ef JS |
44 | |
45 | // Called to transfer data to the window | |
74e3313b | 46 | virtual bool TransferFromWindow(); |
89c684ef JS |
47 | |
48 | protected: | |
49 | void Initialize(); | |
50 | ||
51 | bool* m_pBool; | |
52 | int* m_pInt; | |
53 | wxString* m_pString; | |
54 | wxArrayInt* m_pArrayInt; | |
22f3361e VZ |
55 | |
56 | private: | |
57 | // Cannot use | |
58 | // DECLARE_NO_COPY_CLASS(wxGenericValidator) | |
59 | // because copy constructor is explicitly declared above; | |
60 | // but no copy assignment operator is defined, so declare | |
61 | // it private to prevent the compiler from defining it: | |
62 | wxGenericValidator& operator=(const wxGenericValidator&); | |
89c684ef JS |
63 | }; |
64 | ||
ce4169a4 RR |
65 | #endif |
66 | // wxUSE_VALIDATORS | |
67 | ||
cab1a605 | 68 | #endif |
ce4169a4 | 69 | // _WX_VALGENH__ |