]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/valtext.h
blind fix for wxMac
[wxWidgets.git] / include / wx / valtext.h
index 509ce6d396d212537de89a76e51d9316530cb911..b096aa2c6f9dce22a7aae704b507042e4798f1a8 100644 (file)
@@ -2,7 +2,7 @@
 // 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
@@ -26,6 +26,7 @@ enum wxTextValidatorStyle
     wxFILTER_ASCII,
     wxFILTER_ALPHA,
     wxFILTER_ALPHANUMERIC,
+    wxFILTER_SIMPLE_NUMBER,
     wxFILTER_NUMERIC,
     wxFILTER_INCLUDE_LIST,
     wxFILTER_EXCLUDE_LIST,
@@ -61,6 +62,9 @@ public:
     // 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; }
@@ -70,17 +74,24 @@ public:
 
     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;
@@ -89,13 +100,7 @@ protected:
     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()
 };