]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_validator.i
grid/dbgrid was not getting built for inclusion with this project
[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)"
d14a1e28
RD
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();
dd9f7fea 59 static void SetBellOnError(int doIt = True);
d14a1e28
RD
60
61};
62
63
64//---------------------------------------------------------------------------
65%{
66IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
67IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
68IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
69
70IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
71%}
72
73
74class wxPyValidator : public wxValidator {
75public:
2b9048c5 76 %pythonAppend wxPyValidator "
d14a1e28
RD
77 self._setCallbackInfo(self, PyValidator, 1)
78 self._setOORInfo(self)"
79 wxPyValidator();
80
dd9f7fea 81 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=True);
d14a1e28
RD
82};
83
84
85
86%immutable;
87// See also wxPy_ReinitStockObjects in helpers.cpp
88const wxValidator wxDefaultValidator;
89%mutable;
90
91//---------------------------------------------------------------------------