]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_validator.i
Fixed OOR typo
[wxWidgets.git] / wxPython / src / _validator.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _validator.i
3 // Purpose: SWIG interface for wxValidator
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 24-June-1997
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 //---------------------------------------------------------------------------
18 %newgroup
19
20 /*
21 A validator has up to three purposes:
22
23 1) To validate the data in the window that's associated
24 with the validator.
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.
28
29 Note that wxValidator and derived classes use reference counting.
30 */
31
32 class wxValidator : public wxEvtHandler
33 {
34 public:
35 %pythonAppend wxValidator "self._setOORInfo(self)"
36 wxValidator();
37 //~wxValidator();
38
39
40 // Make a clone of this validator (or return NULL)
41 wxValidator* Clone();
42
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));
46
47 // Called to transfer data to the window
48 virtual bool TransferToWindow();
49
50 // Called to transfer data from the window
51 virtual bool TransferFromWindow();
52
53 wxWindow* GetWindow();
54 void SetWindow(wxWindow* window);
55
56 // validators beep by default if invalid key is pressed, these functions
57 // allow to change it
58 static bool IsSilent();
59 static void SetBellOnError(int doIt = True);
60
61 };
62
63
64 //---------------------------------------------------------------------------
65 %{
66 IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
67 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
68 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
69
70 IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
71 %}
72
73
74 class wxPyValidator : public wxValidator {
75 public:
76 %pythonAppend wxPyValidator "
77 self._setCallbackInfo(self, PyValidator, 1)
78 self._setOORInfo(self)"
79 wxPyValidator();
80
81 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=True);
82 };
83
84
85
86 %immutable;
87 // See also wxPy_ReinitStockObjects in helpers.cpp
88 const wxValidator wxDefaultValidator;
89 %mutable;
90
91 //---------------------------------------------------------------------------