]> git.saurik.com Git - wxWidgets.git/blob - include/wx/valgen.h
added missing #include <wx/defs.h> (parts of patch 649438)
[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 Kevin Smith
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_VALGENH__
13 #define _WX_VALGENH__
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "valgen.h"
17 #endif
18
19 #include "wx/validate.h"
20
21 #if wxUSE_VALIDATORS
22
23 class WXDLLEXPORT wxGenericValidator: public wxValidator
24 {
25 DECLARE_CLASS(wxGenericValidator)
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).
39 virtual wxObject *Clone() const { return new wxGenericValidator(*this); }
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.
44 virtual bool Validate(wxWindow * WXUNUSED(parent)) { return TRUE; }
45
46 // Called to transfer data to the window
47 virtual bool TransferToWindow();
48
49 // Called to transfer data to the window
50 virtual bool TransferFromWindow();
51
52 protected:
53 void Initialize();
54
55 bool* m_pBool;
56 int* m_pInt;
57 wxString* m_pString;
58 wxArrayInt* m_pArrayInt;
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&);
67 };
68
69 #endif
70 // wxUSE_VALIDATORS
71
72 #endif
73 // _WX_VALGENH__