]> git.saurik.com Git - wxWidgets.git/blob - include/wx/valtext.h
LISTs renamed to OBJARRAYs
[wxWidgets.git] / include / wx / valtext.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: valtext.h
3 // Purpose: wxTextValidator class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 29/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_VALTEXTH__
13 #define _WX_VALTEXTH__
14
15 #ifdef __GNUG__
16 #pragma interface "valtext.h"
17 #endif
18
19 #include "wx/validate.h"
20
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
28
29 class WXDLLEXPORT wxTextValidator: public wxValidator
30 {
31 DECLARE_DYNAMIC_CLASS(wxTextValidator)
32 public:
33 wxTextValidator(long style = wxFILTER_NONE, wxString *val = (wxString *) NULL);
34 wxTextValidator(const wxTextValidator& val);
35
36 ~wxTextValidator();
37
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 wxValidator *Clone(void) const { return new wxTextValidator(*this); }
43 bool Copy(const wxTextValidator& val);
44
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);
48
49 // Called to transfer data to the window
50 virtual bool TransferToWindow(void);
51
52 // Called to transfer data to the window
53 virtual bool TransferFromWindow(void);
54
55 // ACCESSORS
56 inline long GetStyle(void) const { return m_validatorStyle; }
57 inline void SetStyle(long style) { m_validatorStyle = style; }
58
59 void SetIncludeList(const wxStringList& list);
60 inline wxStringList& GetIncludeList(void) { return m_includeList; }
61
62 void SetExcludeList(const wxStringList& list);
63 inline wxStringList& GetExcludeList(void) { return m_excludeList; }
64
65 // Filter keystrokes
66 void OnChar(wxKeyEvent& event);
67
68 DECLARE_EVENT_TABLE()
69
70 protected:
71 long m_validatorStyle;
72 wxString * m_stringValue;
73 wxStringList m_includeList;
74 wxStringList m_excludeList;
75 };
76
77 #endif