Fix wxTextValidator introducing a wxTextValidatorStyle enums since it does not support multiple combined styles; fix wxTextValidator::Validate when wxFILTER_EXCLUDE_LIST is used; fixes #1211

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-09 12:43:20 +00:00
parent 79bd5e982b
commit 40ae960071
5 changed files with 192 additions and 142 deletions

View File

@@ -6,6 +6,46 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Styles used by wxTextValidator.
*/
enum wxTextValidatorStyle
{
/// No filtering takes place.
wxFILTER_NONE,
/// Non-ASCII characters are filtered out.
wxFILTER_ASCII,
/// Non-alpha characters are filtered out.
wxFILTER_ALPHA,
/// Non-alphanumeric characters are filtered out.
wxFILTER_ALPHANUMERIC,
/// Non-numeric characters are filtered out.
wxFILTER_NUMERIC,
/// Use an include list. The validator checks if the user input is on
/// the list, complaining if not. See wxTextValidator::SetIncludes().
wxFILTER_INCLUDE_LIST,
/// Use an exclude list. The validator checks if the user input is on
/// the list, complaining if it is. See wxTextValidator::SetExcludes().
wxFILTER_EXCLUDE_LIST,
/// Use an include list. The validator checks if each input character is
/// in the list (one character per list element), complaining if not.
/// See wxTextValidator::SetIncludes().
wxFILTER_INCLUDE_CHAR_LIST,
/// Use an include list. The validator checks if each input character is
/// in the list (one character per list element), complaining if it is.
/// See wxTextValidator::SetExcludes().
wxFILTER_EXCLUDE_CHAR_LIST
};
/**
@class wxTextValidator
@@ -14,33 +54,6 @@
For more information, please see @ref overview_validator.
@beginStyleTable
@style{wxFILTER_NONE}
No filtering takes place.
@style{wxFILTER_ASCII}
Non-ASCII characters are filtered out.
@style{wxFILTER_ALPHA}
Non-alpha characters are filtered out.
@style{wxFILTER_ALPHANUMERIC}
Non-alphanumeric characters are filtered out.
@style{wxFILTER_NUMERIC}
Non-numeric characters are filtered out.
@style{wxFILTER_INCLUDE_LIST}
Use an include list. The validator checks if the user input is on
the list, complaining if not. See SetIncludes().
@style{wxFILTER_EXCLUDE_LIST}
Use an exclude list. The validator checks if the user input is on
the list, complaining if it is. See SetExcludes().
@style{wxFILTER_INCLUDE_CHAR_LIST}
Use an include list. The validator checks if each input character is
in the list (one character per list element), complaining if not.
See SetIncludes().
@style{wxFILTER_EXCLUDE_CHAR_LIST}
Use an include list. The validator checks if each input character is
in the list (one character per list element), complaining if it is.
See SetExcludes().
@endStyleTable
@library{wxcore}
@category{validator}
@@ -53,18 +66,19 @@ public:
Default constructor.
*/
wxTextValidator(const wxTextValidator& validator);
/**
Constructor taking a style and optional pointer to a wxString variable.
@param style
A bitlist of flags documented in the class description.
One of the ::wxTextValidatorStyle styles.
@param 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).
*/
wxTextValidator(long style = wxFILTER_NONE, wxString* valPtr = NULL);
wxTextValidator(wxTextValidatorStyle style = wxFILTER_NONE, wxString* valPtr = NULL);
/**
Clones the text validator using the copy constructor.
@@ -105,7 +119,7 @@ public:
/**
Sets the validator style.
*/
void SetStyle(long style);
void SetStyle(wxTextValidatorStyle style);
/**
Transfers the value in the text control to the string.