Added wxNumericPropertyValidator, which is a custom wxTextValidator with more accurate filtering of inappropriate input for wxIntProperty, wxFloatProperty and wxUIntProperty (fixes #12563).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2010-10-15 15:15:27 +00:00
parent 5ad9ae3a29
commit 026767c6ae
2 changed files with 130 additions and 4 deletions

View File

@@ -143,6 +143,29 @@ enum wxPGNumericValidationConstants
// -----------------------------------------------------------------------
#if wxUSE_VALIDATORS
/**
A more comprehensive numeric validator class.
*/
class wxNumericPropertyValidator : public wxTextValidator
{
public:
enum NumericType
{
Signed = 0,
Unsigned,
Float
};
wxNumericPropertyValidator( NumericType numericType, int base = 10 );
virtual ~wxNumericPropertyValidator() { }
virtual bool Validate(wxWindow* parent);
};
#endif // wxUSE_VALIDATORS
/** @class wxIntProperty
@ingroup classes
Basic property with integer value.
@@ -257,6 +280,7 @@ public:
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const;
virtual wxValidator* DoGetValidator () const;
virtual bool IntToValue( wxVariant& variant,
int number,
int argFlags = 0 ) const;
@@ -302,6 +326,7 @@ public:
wxPGValidationInfo* pValidationInfo,
int mode =
wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator () const;
protected: