]> git.saurik.com Git - wxWidgets.git/blob - include/wx/validate.h
added missing DeleteItem(long itemId) function
[wxWidgets.git] / include / wx / validate.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: validate.h
3 // Purpose: wxValidator class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 29/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Julian Smart
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __VALIDATEH__
13 #define __VALIDATEH__
14
15 #ifdef __GNUG__
16 #pragma interface "validate.h"
17 #endif
18
19 #include "wx/event.h"
20
21 class WXDLLEXPORT wxWindow;
22
23 /*
24 A validator has up to three purposes:
25
26 1) To validate the data in the window that's associated
27 with the validator.
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.
31
32 Note that wxValidator and derived classes use reference counting.
33 */
34
35 class WXDLLEXPORT wxValidator: public wxEvtHandler
36 {
37 DECLARE_DYNAMIC_CLASS(wxValidator)
38 public:
39 wxValidator(void);
40 ~wxValidator();
41
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 NULL; }
47 inline bool Copy(const wxValidator& val) { m_validatorWindow = val.m_validatorWindow; return TRUE; }
48
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; };
52
53 // Called to transfer data to the window
54 virtual bool TransferToWindow(void) { return FALSE; }
55
56 // Called to transfer data from the window
57 virtual bool TransferFromWindow(void) { return FALSE; };
58
59 // ACCESSORS
60 inline wxWindow *GetWindow(void) const { return m_validatorWindow; }
61 inline void SetWindow(wxWindow *win) { m_validatorWindow = win; }
62
63 protected:
64 wxWindow *m_validatorWindow;
65 };
66
67 WXDLLEXPORT_DATA(extern const wxValidator) wxDefaultValidator;
68
69 #endif
70 // __VALIDATEH__