1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTextValidator class
4 // Author: Julian Smart
8 // Copyright: (c) 1998 Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_VALTEXTH__
13 #define _WX_VALTEXTH__
16 #pragma interface "valtext.h"
19 #include "wx/validate.h"
21 #define wxFILTER_NONE 0x0000
22 #define wxFILTER_ASCII 0x0001
23 #define wxFILTER_ALPHA 0x0002
24 #define wxFILTER_ALPHANUMERIC 0x0004
25 #define wxFILTER_NUMERIC 0x0008
26 #define wxFILTER_INCLUDE_LIST 0x0010
27 #define wxFILTER_EXCLUDE_LIST 0x0020
29 class WXDLLEXPORT wxTextValidator
: public wxValidator
31 DECLARE_DYNAMIC_CLASS(wxTextValidator
)
33 wxTextValidator(long style
= wxFILTER_NONE
, wxString
*val
= (wxString
*) NULL
);
34 wxTextValidator(const wxTextValidator
& val
);
38 // Make a clone of this validator (or return NULL) - currently necessary
39 // if you're passing a reference to a validator.
40 // Another possibility is to always pass a pointer to a new validator
41 // (so the calling code can use a copy constructor of the relevant class).
42 virtual wxObject
*Clone(void) const { return new wxTextValidator(*this); }
43 bool Copy(const wxTextValidator
& val
);
45 // Called when the value in the window must be validated.
46 // This function can pop up an error message.
47 virtual bool Validate(wxWindow
*parent
);
49 // Called to transfer data to the window
50 virtual bool TransferToWindow(void);
52 // Called to transfer data to the window
53 virtual bool TransferFromWindow(void);
56 inline long GetStyle(void) const { return m_validatorStyle
; }
57 inline void SetStyle(long style
) { m_validatorStyle
= style
; }
59 void SetIncludeList(const wxStringList
& list
);
60 inline wxStringList
& GetIncludeList(void) { return m_includeList
; }
62 void SetExcludeList(const wxStringList
& list
);
63 inline wxStringList
& GetExcludeList(void) { return m_excludeList
; }
66 void OnChar(wxKeyEvent
& event
);
71 long m_validatorStyle
;
72 wxString
* m_stringValue
;
73 wxStringList m_includeList
;
74 wxStringList m_excludeList
;