Did somework on the generic dialogs,
[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 #ifdef __GNUG__
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 public:
26 wxGenericValidator(bool* val);
27 wxGenericValidator(int* val);
28 wxGenericValidator(wxString* val);
29 wxGenericValidator(wxArrayInt* val);
30 wxGenericValidator(const wxGenericValidator& copyFrom);
31
32 ~wxGenericValidator();
33
34 // Make a clone of this validator (or return NULL) - currently necessary
35 // if you're passing a reference to a validator.
36 // Another possibility is to always pass a pointer to a new validator
37 // (so the calling code can use a copy constructor of the relevant class).
38 virtual wxObject *Clone() const { return new wxGenericValidator(*this); }
39 bool Copy(const wxGenericValidator& val);
40
41 // Called when the value in the window must be validated.
42 // This function can pop up an error message.
43 virtual bool Validate(wxWindow * WXUNUSED(parent)) { return TRUE; }
44
45 // Called to transfer data to the window
46 virtual bool TransferToWindow();
47
48 // Called to transfer data to the window
49 virtual bool TransferFromWindow();
50
51 protected:
52 void Initialize();
53
54 bool* m_pBool;
55 int* m_pInt;
56 wxString* m_pString;
57 wxArrayInt* m_pArrayInt;
58 };
59
60 #endif
61 // wxUSE_VALIDATORS
62
63 #endif
64 // _WX_VALGENH__