]>
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_validatoroverview "Validator
22 @see @ref overview_validatoroverview "Validator overview", wxValidator,
25 class wxTextValidator
: public wxValidator
30 Constructor, taking a style and optional pointer to a wxString variable.
33 A bitlist of flags, which can be:
46 No filtering takes place.
57 Non-ASCII characters are filtered out.
68 Non-alpha characters are filtered out.
79 Non-alphanumeric characters are filtered out.
90 Non-numeric characters are filtered out.
101 Use an include list. The validator
102 checks if the user input is on the list, complaining if not. See
109 wxFILTER_EXCLUDE_LIST
114 Use an exclude list. The validator
115 checks if the user input is on the list, complaining if it is. See
122 wxFILTER_INCLUDE_CHAR_LIST
127 Use an include list. The validator
128 checks if each input character is in the list (one character per list
129 element), complaining if not.
136 wxFILTER_EXCLUDE_CHAR_LIST
141 Use an include list. The validator
142 checks if each input character is in the list (one character per list
143 element), complaining if it is.
146 A pointer to a wxString variable that contains the value. This variable
147 should have a lifetime equal to or longer than the validator lifetime
149 determined by the lifetime of the window).
151 wxTextValidator(const wxTextValidator
& validator
);
152 wxTextValidator(long style
= wxFILTER_NONE
,
153 wxString
* valPtr
= NULL
);
157 Clones the text validator using the copy constructor.
159 virtual wxValidator
* Clone() const;
162 Returns a reference to the exclude list (the list of invalid values).
164 wxArrayString
GetExcludes() const;
167 Returns a reference to the include list (the list of valid values).
169 wxArrayString
GetIncludes() const;
172 Returns the validator style.
174 long GetStyle() const;
177 Receives character input from the window and filters it according to the
178 current validator style.
180 void OnChar(wxKeyEvent
& event
);
183 Sets the exclude list (invalid values for the user input).
185 void SetExcludes(const wxArrayString
& stringList
);
188 Sets the include list (valid values for the user input).
190 void SetIncludes(const wxArrayString
& stringList
);
193 Sets the validator style.
195 void SetStyle(long style
);
198 Transfers the value in the text control to the string.
200 virtual bool TransferFromWindow();
203 Transfers the string value to the text control.
205 virtual bool TransferToWindow();
208 Validates the window contents against the include or exclude lists, depending
209 on the validator style.
211 virtual bool Validate(wxWindow
* parent
);