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 %pythonAppend wxValidator "self._setOORInfo(self)"
36 %typemap(out) wxValidator*; // turn off this typemap
41 // Turn it back on again
42 %typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
45 // Make a clone of this validator (or return NULL)
48 // Called when the value in the window must be validated.
49 // This function can pop up an error message.
50 virtual bool Validate(wxWindow *WXUNUSED(parent));
52 // Called to transfer data to the window
53 virtual bool TransferToWindow();
55 // Called to transfer data from the window
56 virtual bool TransferFromWindow();
58 wxWindow* GetWindow();
59 void SetWindow(wxWindow* window);
61 // validators beep by default if invalid key is pressed, these functions
63 static bool IsSilent();
64 static void SetBellOnError(int doIt = true);
69 //---------------------------------------------------------------------------
71 IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
72 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
73 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
75 IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
79 class wxPyValidator : public wxValidator {
81 %pythonAppend wxPyValidator "
82 self._setCallbackInfo(self, PyValidator, 1)
83 self._setOORInfo(self)"
86 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=true);
92 // See also wxPy_ReinitStockObjects in helpers.cpp
93 const wxValidator wxDefaultValidator;
96 //---------------------------------------------------------------------------