1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxValidator
7 // Created: 24-June-1997
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
17 //---------------------------------------------------------------------------
21 A validator has up to three purposes:
23 1) To validate the data in the window that's associated
25 2) To transfer data to and from the window.
26 3) To filter input, using its role as a wxEvtHandler
27 to intercept e.g. OnChar.
29 Note that wxValidator and derived classes use reference counting.
32 class wxValidator : public wxEvtHandler
35 %addtofunc wxValidator "self._setOORInfo(self)"
40 // Make a clone of this validator (or return NULL)
43 // Called when the value in the window must be validated.
44 // This function can pop up an error message.
45 virtual bool Validate(wxWindow *WXUNUSED(parent));
47 // Called to transfer data to the window
48 virtual bool TransferToWindow();
50 // Called to transfer data from the window
51 virtual bool TransferFromWindow();
53 wxWindow* GetWindow();
54 void SetWindow(wxWindow* window);
56 // validators beep by default if invalid key is pressed, these functions
58 static bool IsSilent();
59 static void SetBellOnError(int doIt = TRUE);
64 //---------------------------------------------------------------------------
66 IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
67 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
68 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
70 IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
74 class wxPyValidator : public wxValidator {
76 %addtofunc wxPyValidator "
77 self._setCallbackInfo(self, PyValidator, 1)
78 self._setOORInfo(self)"
81 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=TRUE);
87 // See also wxPy_ReinitStockObjects in helpers.cpp
88 const wxValidator wxDefaultValidator;
91 //---------------------------------------------------------------------------