]>
git.saurik.com Git - wxWidgets.git/blob - interface/valtext.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTextValidator
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxTextValidator
13 wxTextValidator validates text controls, providing a variety of filtering
16 For more information, please see @ref overview_validator.
20 No filtering takes place.
21 @style{wxFILTER_ASCII}
22 Non-ASCII characters are filtered out.
23 @style{wxFILTER_ALPHA}
24 Non-alpha characters are filtered out.
25 @style{wxFILTER_ALPHANUMERIC}
26 Non-alphanumeric characters are filtered out.
27 @style{wxFILTER_NUMERIC}
28 Non-numeric characters are filtered out.
29 @style{wxFILTER_INCLUDE_LIST}
30 Use an include list. The validator checks if the user input is on
31 the list, complaining if not. See SetIncludes().
32 @style{wxFILTER_EXCLUDE_LIST}
33 Use an exclude list. The validator checks if the user input is on
34 the list, complaining if it is. See SetExcludes().
35 @style{wxFILTER_INCLUDE_CHAR_LIST}
36 Use an include list. The validator checks if each input character is
37 in the list (one character per list element), complaining if not.
39 @style{wxFILTER_EXCLUDE_CHAR_LIST}
40 Use an include list. The validator checks if each input character is
41 in the list (one character per list element), complaining if it is.
48 @see @ref overview_validator, wxValidator, wxGenericValidator
50 class wxTextValidator
: public wxValidator
56 wxTextValidator(const wxTextValidator
& validator
);
58 Constructor taking a style and optional pointer to a wxString variable.
61 A bitlist of flags documented in the class description.
63 A pointer to a wxString variable that contains the value. This
64 variable should have a lifetime equal to or longer than the
65 validator lifetime (which is usually determined by the lifetime of
68 wxTextValidator(long style
= wxFILTER_NONE
, wxString
* valPtr
= NULL
);
71 Clones the text validator using the copy constructor.
73 virtual wxValidator
* Clone() const;
76 Returns a reference to the exclude list (the list of invalid values).
78 wxArrayString
& GetExcludes() const;
81 Returns a reference to the include list (the list of valid values).
83 wxArrayString
& GetIncludes() const;
86 Returns the validator style.
88 long GetStyle() const;
91 Receives character input from the window and filters it according to
92 the current validator style.
94 void OnChar(wxKeyEvent
& event
);
97 Sets the exclude list (invalid values for the user input).
99 void SetExcludes(const wxArrayString
& stringList
);
102 Sets the include list (valid values for the user input).
104 void SetIncludes(const wxArrayString
& stringList
);
107 Sets the validator style.
109 void SetStyle(long style
);
112 Transfers the value in the text control to the string.
114 virtual bool TransferFromWindow();
117 Transfers the string value to the text control.
119 virtual bool TransferToWindow();
122 Validates the window contents against the include or exclude lists,
123 depending on the validator style.
125 virtual bool Validate(wxWindow
* parent
);