]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/valtext.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTextValidator
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxTextValidator
12 wxTextValidator validates text controls, providing a variety of filtering
15 For more information, please see @ref overview_validator.
19 No filtering takes place.
20 @style{wxFILTER_ASCII}
21 Non-ASCII characters are filtered out.
22 @style{wxFILTER_ALPHA}
23 Non-alpha characters are filtered out.
24 @style{wxFILTER_ALPHANUMERIC}
25 Non-alphanumeric characters are filtered out.
26 @style{wxFILTER_NUMERIC}
27 Non-numeric characters are filtered out.
28 @style{wxFILTER_INCLUDE_LIST}
29 Use an include list. The validator checks if the user input is on
30 the list, complaining if not. See SetIncludes().
31 @style{wxFILTER_EXCLUDE_LIST}
32 Use an exclude list. The validator checks if the user input is on
33 the list, complaining if it is. See SetExcludes().
34 @style{wxFILTER_INCLUDE_CHAR_LIST}
35 Use an include list. The validator checks if each input character is
36 in the list (one character per list element), complaining if not.
38 @style{wxFILTER_EXCLUDE_CHAR_LIST}
39 Use an include list. The validator checks if each input character is
40 in the list (one character per list element), complaining if it is.
47 @see @ref overview_validator, wxValidator, wxGenericValidator
49 class wxTextValidator
: public wxValidator
55 wxTextValidator(const wxTextValidator
& validator
);
57 Constructor taking a style and optional pointer to a wxString variable.
60 A bitlist of flags documented in the class description.
62 A pointer to a wxString variable that contains the value. This
63 variable should have a lifetime equal to or longer than the
64 validator lifetime (which is usually determined by the lifetime of
67 wxTextValidator(long style
= wxFILTER_NONE
, wxString
* valPtr
= NULL
);
70 Clones the text validator using the copy constructor.
72 virtual wxValidator
* Clone() const;
75 Returns a reference to the exclude list (the list of invalid values).
77 wxArrayString
& GetExcludes();
80 Returns a reference to the include list (the list of valid values).
82 wxArrayString
& GetIncludes();
85 Returns the validator style.
87 long GetStyle() const;
90 Receives character input from the window and filters it according to
91 the current validator style.
93 void OnChar(wxKeyEvent
& event
);
96 Sets the exclude list (invalid values for the user input).
98 void SetExcludes(const wxArrayString
& stringList
);
101 Sets the include list (valid values for the user input).
103 void SetIncludes(const wxArrayString
& stringList
);
106 Sets the validator style.
108 void SetStyle(long style
);
111 Transfers the value in the text control to the string.
113 virtual bool TransferFromWindow();
116 Transfers the string value to the text control.
118 virtual bool TransferToWindow();
121 Validates the window contents against the include or exclude lists,
122 depending on the validator style.
124 virtual bool Validate(wxWindow
* parent
);