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