X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/58fa61dbad0ea1158f6c6e96d611c26057e069ba..d3fa4bc22e84e3ca4d88cc1772f2d414140a1017:/interface/wx/valtext.h?ds=sidebyside diff --git a/interface/wx/valtext.h b/interface/wx/valtext.h index 55978a5c4c..f0d03f5f97 100644 --- a/interface/wx/valtext.h +++ b/interface/wx/valtext.h @@ -3,7 +3,7 @@ // Purpose: interface of wxTextValidator // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ enum wxTextValidatorStyle wxFILTER_DIGITS, /// Non-numeric characters are filtered out. - /// Works like @c wxFILTER_SIMPLE_NUMBER but allows also decimal points, + /// Works like @c wxFILTER_DIGITS but allows also decimal points, /// minus/plus signs and the 'e' or 'E' character to input exponents. /// Note that this is not the same behaviour of wxString::IsNumber(). wxFILTER_NUMERIC, @@ -77,7 +77,8 @@ enum wxTextValidatorStyle @library{wxcore} @category{validator} - @see @ref overview_validator, wxValidator, wxGenericValidator + @see @ref overview_validator, wxValidator, wxGenericValidator, + wxIntegerValidator, wxFloatingPointValidator */ class wxTextValidator : public wxValidator { @@ -117,9 +118,16 @@ public: /** Returns the validator style. + + @see HasFlag() */ long GetStyle() const; + /** + Returns @true if the given @a style bit is set in the current style. + */ + bool HasFlag(wxTextValidatorStyle style) const; + /** Receives character input from the window and filters it according to the current validator style. @@ -159,6 +167,10 @@ public: 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. */ void SetStyle(long style); @@ -177,5 +189,25 @@ public: depending on the validator style. */ virtual bool Validate(wxWindow* parent); + +protected: + + /** + Returns @true if all the characters of the given @a val string + are present in the include list (set by SetIncludes() or SetCharIncludes()). + */ + bool ContainsOnlyIncludedCharacters(const wxString& val) const; + + /** + Returns true if at least one character of the given @a val string + is present in the exclude list (set by SetExcludes() or SetCharExcludes()). + */ + bool ContainsExcludedCharacters(const wxString& val) const; + + /** + Returns the error message if the contents of @a val are invalid + or the empty string if @a val is valid. + */ + virtual wxString IsValid(const wxString& val) const; };