4 * Created on: 27 avr. 2009
8 #ifndef COMMON__VALIDATORS_H_
9 #define COMMON__VALIDATORS_H_
11 #include <wx/wxprec.h>
12 #include <wx/validate.h>
15 //******************************
16 // Validator which only allow a set of characters
18 class wxValidator_Restrict
: public wxValidator
21 wxValidator_Restrict( const wxString
& _only_those
, wxString
* valPtr
= NULL
);
22 wxValidator_Restrict(const wxValidator_Restrict
& from
);
24 DECLARE_EVENT_TABLE();
30 wxObject
* Clone() const;
31 bool Validate(wxWindow
* parent
);
32 bool TransferToWindow();
33 bool TransferFromWindow();
34 bool CharAccepted( int kc
);
36 void OnChar(wxKeyEvent
& event
);
41 //******************************
42 // Validator which only allow a set of characters
44 class wxValidator_Restrict_Range
: public wxValidator
47 wxValidator_Restrict_Range(wxChar _from_here
, wxChar _to_here
, wxString
* valPtr
= NULL
);
48 wxValidator_Restrict_Range(const wxValidator_Restrict_Range
& from
);
50 DECLARE_EVENT_TABLE();
57 wxObject
* Clone() const;
58 bool Validate(wxWindow
* parent
);
59 bool TransferToWindow();
60 bool TransferFromWindow();
61 bool CharAccepted( int kc
);
63 void OnChar(wxKeyEvent
& event
);
73 //******************************
74 // Validator which not allow White spaces
76 class wxTextValidator_NoWhiteSpace
: public wxValidator
79 wxTextValidator_NoWhiteSpace( wxString
* valPtr
= NULL
);
80 wxTextValidator_NoWhiteSpace(const wxTextValidator_NoWhiteSpace
& from
);
82 DECLARE_EVENT_TABLE();
87 wxObject
* Clone() const;
88 bool Validate(wxWindow
* parent
);
89 bool TransferToWindow();
90 bool TransferFromWindow();
92 void OnChar(wxKeyEvent
& event
);
97 //******************************
100 class wxValidatorIntegerRelative
: public wxValidator
103 wxValidatorIntegerRelative( wxString
* valPtr
= NULL
);
104 wxValidatorIntegerRelative(const wxValidatorIntegerRelative
& from
);
106 DECLARE_EVENT_TABLE();
111 wxObject
* Clone() const;
112 bool Validate(wxWindow
* parent
);
113 bool TransferToWindow();
114 bool TransferFromWindow();
116 void OnChar(wxKeyEvent
& event
);
121 //******************************
124 class wxValidatorIntegerNegative
: public wxValidatorIntegerRelative
127 wxValidatorIntegerNegative( wxString
* valPtr
= NULL
);
128 wxValidatorIntegerNegative(const wxValidatorIntegerNegative
& from
);
130 DECLARE_EVENT_TABLE();
131 void OnChar( wxKeyEvent
& event
);
134 wxObject
* Clone() const;
135 bool Validate(wxWindow
* parent
);
140 //******************************
143 class wxValidatorFloat
: public wxValidator
146 wxValidatorFloat( wxString
* valPtr
= NULL
);
147 wxValidatorFloat(const wxValidatorFloat
& from
);
149 DECLARE_EVENT_TABLE();
154 wxObject
* Clone() const;
155 bool Validate(wxWindow
* parent
);
156 bool TransferToWindow();
157 bool TransferFromWindow();
159 void OnChar(wxKeyEvent
& event
);
164 //******************************
167 class wxValidatorFloatPositive
: public wxValidatorFloat
170 wxValidatorFloatPositive( wxString
* valPtr
= NULL
);
171 wxValidatorFloatPositive(const wxValidatorFloatPositive
& from
);
173 DECLARE_EVENT_TABLE();
178 wxObject
* Clone() const;
179 bool Validate(wxWindow
* parent
);
180 bool TransferToWindow();
181 bool TransferFromWindow();
183 void OnChar(wxKeyEvent
& event
);
187 #endif /* COMMON__VALIDATORS_H_ */