]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_validator.i
added missing button state
[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 %typemap(out) wxValidator*; // turn off this typemap
37
38 wxValidator();
39 //~wxValidator();
40
41 // Turn it back on again
42 %typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
43
44
45 // Make a clone of this validator (or return NULL)
46 wxValidator* Clone();
47
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));
51
52 // Called to transfer data to the window
53 virtual bool TransferToWindow();
54
55 // Called to transfer data from the window
56 virtual bool TransferFromWindow();
57
58 wxWindow* GetWindow();
59 void SetWindow(wxWindow* window);
60
61 // validators beep by default if invalid key is pressed, these functions
62 // allow to change it
63 static bool IsSilent();
64 static void SetBellOnError(int doIt = true);
65
66 %property(Window, GetWindow, SetWindow, doc="See `GetWindow` and `SetWindow`");
67 };
68
69
70 //---------------------------------------------------------------------------
71 %{
72 IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
73 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
74 IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
75
76 IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
77 %}
78
79
80 class wxPyValidator : public wxValidator {
81 public:
82 %pythonAppend wxPyValidator "self._setOORInfo(self);" setCallbackInfo(PyValidator)
83
84 wxPyValidator();
85
86 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1);
87 };
88
89
90
91 %immutable;
92 const wxValidator wxDefaultValidator;
93 %mutable;
94
95 //---------------------------------------------------------------------------