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