]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_validator.i
Version
[wxWidgets.git] / wxPython / src / _validator.i
CommitLineData
d14a1e28
RD
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
32class wxValidator : public wxEvtHandler
33{
34public:
2b9048c5 35 %pythonAppend wxValidator "self._setOORInfo(self)"
b39c3fa0
RD
36 %typemap(out) wxValidator*; // turn off this typemap
37
d14a1e28
RD
38 wxValidator();
39 //~wxValidator();
40
b39c3fa0
RD
41 // Turn it back on again
42 %typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
d14a1e28 43
b39c3fa0 44
d14a1e28
RD
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();
a72f4631 64 static void SetBellOnError(int doIt = true);
d14a1e28
RD
65
66};
67
68
69//---------------------------------------------------------------------------
70%{
71IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
72IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
73IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
74
75IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
76%}
77
78
79class wxPyValidator : public wxValidator {
80public:
2b9048c5 81 %pythonAppend wxPyValidator "
d14a1e28
RD
82 self._setCallbackInfo(self, PyValidator, 1)
83 self._setOORInfo(self)"
84 wxPyValidator();
85
a72f4631 86 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=true);
d14a1e28
RD
87};
88
89
90
91%immutable;
92// See also wxPy_ReinitStockObjects in helpers.cpp
93const wxValidator wxDefaultValidator;
94%mutable;
95
96//---------------------------------------------------------------------------