]> git.saurik.com Git - wxWidgets.git/blame - include/wx/valtext.h
add wxPosixPermissions enumeration; it provides more readable synonims for wxS_I...
[wxWidgets.git] / include / wx / valtext.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: valtext.h
3// Purpose: wxTextValidator class
4// Author: Julian Smart
5// Modified by:
6// Created: 29/01/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Julian Smart
cab1a605 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
92646f5a
PC
12#ifndef _WX_VALTEXT_H_
13#define _WX_VALTEXT_H_
c801d85f 14
ce4169a4
RR
15#include "wx/defs.h"
16
472eec8a 17#if wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX)
88ac883a 18
92646f5a
PC
19class WXDLLIMPEXP_FWD_CORE wxTextEntry;
20
c801d85f
KB
21#include "wx/validate.h"
22
23#define wxFILTER_NONE 0x0000
24#define wxFILTER_ASCII 0x0001
25#define wxFILTER_ALPHA 0x0002
26#define wxFILTER_ALPHANUMERIC 0x0004
27#define wxFILTER_NUMERIC 0x0008
28#define wxFILTER_INCLUDE_LIST 0x0010
29#define wxFILTER_EXCLUDE_LIST 0x0020
aaae8296
JS
30#define wxFILTER_INCLUDE_CHAR_LIST 0x0040
31#define wxFILTER_EXCLUDE_CHAR_LIST 0x0080
c801d85f 32
53a2db12 33class WXDLLIMPEXP_CORE wxTextValidator: public wxValidator
c801d85f
KB
34{
35DECLARE_DYNAMIC_CLASS(wxTextValidator)
36public:
c801d85f 37
33c5b54b
RL
38 wxTextValidator(long style = wxFILTER_NONE, wxString *val = 0);
39 wxTextValidator(const wxTextValidator& val);
c801d85f 40
d3c7fc99 41 virtual ~wxTextValidator(){}
c801d85f 42
33c5b54b
RL
43 // Make a clone of this validator (or return NULL) - currently necessary
44 // if you're passing a reference to a validator.
45 // Another possibility is to always pass a pointer to a new validator
46 // (so the calling code can use a copy constructor of the relevant class).
47 virtual wxObject *Clone() const { return new wxTextValidator(*this); }
48 bool Copy(const wxTextValidator& val);
c801d85f 49
33c5b54b
RL
50 // Called when the value in the window must be validated.
51 // This function can pop up an error message.
52 virtual bool Validate(wxWindow *parent);
c801d85f 53
33c5b54b
RL
54 // Called to transfer data to the window
55 virtual bool TransferToWindow();
c801d85f 56
4deaa8db 57 // Called to transfer data from the window
33c5b54b 58 virtual bool TransferFromWindow();
c801d85f 59
33c5b54b
RL
60 // ACCESSORS
61 inline long GetStyle() const { return m_validatorStyle; }
62 inline void SetStyle(long style) { m_validatorStyle = style; }
c801d85f 63
472eec8a 64 wxTextEntry *GetTextEntry();
f94a790d
RN
65
66 void SetIncludes(const wxArrayString& includes) { m_includes = includes; }
67 inline wxArrayString& GetIncludes() { return m_includes; }
68
69 void SetExcludes(const wxArrayString& excludes) { m_excludes = excludes; }
70 inline wxArrayString& GetExcludes() { return m_excludes; }
71
72 bool IsInCharIncludes(const wxString& val);
73 bool IsNotInCharExcludes(const wxString& val);
33c5b54b
RL
74
75 // Filter keystrokes
76 void OnChar(wxKeyEvent& event);
c801d85f
KB
77
78DECLARE_EVENT_TABLE()
79
80protected:
81 long m_validatorStyle;
82 wxString * m_stringValue;
f94a790d
RN
83 wxArrayString m_includes;
84 wxArrayString m_excludes;
33c5b54b 85
22f3361e
VZ
86private:
87// Cannot use
88// DECLARE_NO_COPY_CLASS(wxTextValidator)
89// because copy constructor is explicitly declared above;
90// but no copy assignment operator is defined, so declare
91// it private to prevent the compiler from defining it:
92 wxTextValidator& operator=(const wxTextValidator&);
c801d85f
KB
93};
94
95#endif
472eec8a 96 // wxUSE_VALIDATORS && (wxUSE_TEXTCTRL || wxUSE_COMBOBOX)
ce4169a4 97
92646f5a 98#endif // _WX_VALTEXT_H_