]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/validate.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxValidator class
4 // Author: Julian Smart
8 // Copyright: (c) 1998 Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_VALIDATEH__
13 #define _WX_VALIDATEH__
16 #pragma interface "validate.h"
21 class WXDLLEXPORT wxWindow
;
24 A validator has up to three purposes:
26 1) To validate the data in the window that's associated
28 2) To transfer data to and from the window.
29 3) To filter input, using its role as a wxEvtHandler
30 to intercept e.g. OnChar.
32 Note that wxValidator and derived classes use reference counting.
35 class WXDLLEXPORT wxValidator
: public wxEvtHandler
37 DECLARE_DYNAMIC_CLASS(wxValidator
)
42 // Make a clone of this validator (or return NULL) - currently necessary
43 // if you're passing a reference to a validator.
44 // Another possibility is to always pass a pointer to a new validator
45 // (so the calling code can use a copy constructor of the relevant class).
46 virtual wxValidator
*Clone(void) const { return (wxValidator
*) NULL
; }
47 inline bool Copy(const wxValidator
& val
) { m_validatorWindow
= val
.m_validatorWindow
; return TRUE
; }
49 // Called when the value in the window must be validated.
50 // This function can pop up an error message.
51 virtual bool Validate(wxWindow
*WXUNUSED(parent
)) { return FALSE
; };
53 // Called to transfer data to the window
54 virtual bool TransferToWindow(void) { return FALSE
; }
56 // Called to transfer data from the window
57 virtual bool TransferFromWindow(void) { return FALSE
; };
60 inline wxWindow
*GetWindow(void) const { return m_validatorWindow
; }
61 inline void SetWindow(wxWindow
*win
) { m_validatorWindow
= win
; }
64 wxWindow
*m_validatorWindow
;
67 WXDLLEXPORT_DATA(extern const wxValidator
) wxDefaultValidator
;