// Name: valtext.h
// Purpose: wxTextValidator class
// Author: Julian Smart
-// Modified by:
+// Modified by: Francesco Montorsi
// Created: 29/01/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
wxFILTER_ASCII,
wxFILTER_ALPHA,
wxFILTER_ALPHANUMERIC,
+ wxFILTER_SIMPLE_NUMBER,
wxFILTER_NUMERIC,
wxFILTER_INCLUDE_LIST,
wxFILTER_EXCLUDE_LIST,
// Called to transfer data from the window
virtual bool TransferFromWindow();
+ // Filter keystrokes
+ void OnChar(wxKeyEvent& event);
+
// ACCESSORS
inline wxTextValidatorStyle GetStyle() const { return m_validatorStyle; }
inline void SetStyle(wxTextValidatorStyle style) { m_validatorStyle = style; }
wxTextEntry *GetTextEntry();
+ void SetCharIncludes(const wxString& chars);
void SetIncludes(const wxArrayString& includes) { m_includes = includes; }
inline wxArrayString& GetIncludes() { return m_includes; }
+ void SetCharExcludes(const wxString& chars);
void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; }
inline wxArrayString& GetExcludes() { return m_excludes; }
- bool IsInCharIncludes(const wxString& val);
- bool IsNotInCharExcludes(const wxString& val);
+protected:
- // Filter keystrokes
- void OnChar(wxKeyEvent& event);
+ // returns true if all characters of the given string are present in m_includes
+ bool ContainsOnlyIncludedCharacters(const wxString& val) const;
+
+ // returns true if all characters of the given string are NOT present in m_excludes
+ bool ContainsExcludedCharacters(const wxString& val) const;
+
+ // returns true if the contents of 'val' are valid for the current validation style
+ virtual bool IsValid(const wxString& val, wxString* errormsg) const;
protected:
wxTextValidatorStyle m_validatorStyle;
wxArrayString m_excludes;
private:
-// Cannot use
-// DECLARE_NO_COPY_CLASS(wxTextValidator)
-// because copy constructor is explicitly declared above;
-// but no copy assignment operator is defined, so declare
-// it private to prevent the compiler from defining it:
- wxTextValidator& operator=(const wxTextValidator&);
-
+ DECLARE_NO_ASSIGN_CLASS(wxTextValidator)
DECLARE_DYNAMIC_CLASS(wxTextValidator)
DECLARE_EVENT_TABLE()
};