#include </home/zeitlin/src/wx/github/interface/wx/valtext.h>
wxTextValidator validates text controls, providing a variety of filtering behaviours.
For more information, please see wxValidator Overview.
Public Member Functions | |
wxTextValidator (const wxTextValidator &validator) | |
Default constructor. | |
wxTextValidator (long style=wxFILTER_NONE, wxString *valPtr=NULL) | |
Constructor taking a style and optional pointer to a wxString variable. | |
virtual wxObject * | Clone () const |
Clones the text validator using the copy constructor. | |
wxArrayString & | GetExcludes () |
Returns a reference to the exclude list (the list of invalid values). | |
wxArrayString & | GetIncludes () |
Returns a reference to the include list (the list of valid values). | |
long | GetStyle () const |
Returns the validator style. | |
bool | HasFlag (wxTextValidatorStyle style) const |
Returns true if the given style bit is set in the current style. | |
void | OnChar (wxKeyEvent &event) |
Receives character input from the window and filters it according to the current validator style. | |
void | SetExcludes (const wxArrayString &stringList) |
Sets the exclude list (invalid values for the user input). | |
void | SetCharExcludes (const wxString &chars) |
Breaks the given chars strings in single characters and sets the internal wxArrayString used to store the "excluded" characters (see SetExcludes()). | |
void | SetIncludes (const wxArrayString &stringList) |
Sets the include list (valid values for the user input). | |
void | SetCharIncludes (const wxString &chars) |
Breaks the given chars strings in single characters and sets the internal wxArrayString used to store the "included" characters (see SetIncludes()). | |
void | SetStyle (long style) |
Sets the validator style which must be a combination of one or more of the wxTextValidatorStyle values. | |
virtual bool | TransferFromWindow () |
Transfers the value in the text control to the string. | |
virtual bool | TransferToWindow () |
Transfers the string value to the text control. | |
virtual bool | Validate (wxWindow *parent) |
Validates the window contents against the include or exclude lists, depending on the validator style. | |
Protected Member Functions | |
bool | ContainsOnlyIncludedCharacters (const wxString &val) const |
Returns true if all the characters of the given val string are present in the include list (set by SetIncludes() or SetCharIncludes()). | |
bool | ContainsExcludedCharacters (const wxString &val) const |
Returns true if at least one character of the given val string is present in the exclude list (set by SetExcludes() or SetCharExcludes()). | |
virtual wxString | IsValid (const wxString &val) const |
Returns the error message if the contents of val are invalid or the empty string if val is valid. |
wxTextValidator::wxTextValidator | ( | const wxTextValidator & | validator | ) |
Default constructor.
wxTextValidator::wxTextValidator | ( | long | style = wxFILTER_NONE , |
wxString * | valPtr = NULL |
||
) |
Constructor taking a style and optional pointer to a wxString variable.
style | One or more of the wxTextValidatorStyle styles. See SetStyle(). |
valPtr | A pointer to a wxString variable that contains the value. This variable should have a lifetime equal to or longer than the validator lifetime (which is usually determined by the lifetime of the window). |
virtual wxObject* wxTextValidator::Clone | ( | ) | const [virtual] |
Clones the text validator using the copy constructor.
Reimplemented from wxValidator.
bool wxTextValidator::ContainsExcludedCharacters | ( | const wxString & | val | ) | const [protected] |
Returns true if at least one character of the given val string is present in the exclude list (set by SetExcludes() or SetCharExcludes()).
bool wxTextValidator::ContainsOnlyIncludedCharacters | ( | const wxString & | val | ) | const [protected] |
Returns true if all the characters of the given val string are present in the include list (set by SetIncludes() or SetCharIncludes()).
wxArrayString& wxTextValidator::GetExcludes | ( | ) |
Returns a reference to the exclude list (the list of invalid values).
wxArrayString& wxTextValidator::GetIncludes | ( | ) |
Returns a reference to the include list (the list of valid values).
long wxTextValidator::GetStyle | ( | ) | const |
Returns the validator style.
bool wxTextValidator::HasFlag | ( | wxTextValidatorStyle | style | ) | const |
Returns true if the given style bit is set in the current style.
Returns the error message if the contents of val are invalid or the empty string if val is valid.
void wxTextValidator::OnChar | ( | wxKeyEvent & | event | ) |
Receives character input from the window and filters it according to the current validator style.
void wxTextValidator::SetCharExcludes | ( | const wxString & | chars | ) |
Breaks the given chars strings in single characters and sets the internal wxArrayString used to store the "excluded" characters (see SetExcludes()).
This function is mostly useful when wxFILTER_EXCLUDE_CHAR_LIST
was used.
void wxTextValidator::SetCharIncludes | ( | const wxString & | chars | ) |
Breaks the given chars strings in single characters and sets the internal wxArrayString used to store the "included" characters (see SetIncludes()).
This function is mostly useful when wxFILTER_INCLUDE_CHAR_LIST
was used.
void wxTextValidator::SetExcludes | ( | const wxArrayString & | stringList | ) |
Sets the exclude list (invalid values for the user input).
void wxTextValidator::SetIncludes | ( | const wxArrayString & | stringList | ) |
Sets the include list (valid values for the user input).
void wxTextValidator::SetStyle | ( | long | style | ) |
Sets the validator style which must be a combination of one or more of the wxTextValidatorStyle values.
Note that not all possible combinations make sense! Also note that the order in which the checks are performed is important, in case you specify more than a single style. wxTextValidator will perform the checks in the same definition order used in the wxTextValidatorStyle enumeration.
virtual bool wxTextValidator::TransferFromWindow | ( | ) | [virtual] |
Transfers the value in the text control to the string.
Reimplemented from wxValidator.
virtual bool wxTextValidator::TransferToWindow | ( | ) | [virtual] |
Transfers the string value to the text control.
Reimplemented from wxValidator.
virtual bool wxTextValidator::Validate | ( | wxWindow * | parent | ) | [virtual] |
Validates the window contents against the include or exclude lists, depending on the validator style.
Reimplemented from wxValidator.