Files
wxWidgets/wxPython/src/_validator.i
Robin Dunn 99a001dd43 Changed how the stock objects (wx.RED, wx.RED_PEN, wx.RED_BRUSH, etc.)
are initialized.  They are now created as a wrapper object that
initializes itself on first use (when an attribute of the object is
requested.)  This was needed because of similar delayed initialization
functionality that was implemented in wxWidgets, but the end result is
cleaner for wxPython as well, and allowed me to remove some ugly code
under the covers.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38802 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-04-18 21:49:48 +00:00

96 lines
2.6 KiB
OpenEdge ABL

/////////////////////////////////////////////////////////////////////////////
// Name: _validator.i
// Purpose: SWIG interface for wxValidator
//
// Author: Robin Dunn
//
// Created: 24-June-1997
// RCS-ID: $Id$
// Copyright: (c) 2003 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
%newgroup
/*
A validator has up to three purposes:
1) To validate the data in the window that's associated
with the validator.
2) To transfer data to and from the window.
3) To filter input, using its role as a wxEvtHandler
to intercept e.g. OnChar.
Note that wxValidator and derived classes use reference counting.
*/
class wxValidator : public wxEvtHandler
{
public:
%pythonAppend wxValidator "self._setOORInfo(self)"
%typemap(out) wxValidator*; // turn off this typemap
wxValidator();
//~wxValidator();
// Turn it back on again
%typemap(out) wxValidator* { $result = wxPyMake_wxObject($1, $owner); }
// Make a clone of this validator (or return NULL)
wxValidator* Clone();
// Called when the value in the window must be validated.
// This function can pop up an error message.
virtual bool Validate(wxWindow *WXUNUSED(parent));
// Called to transfer data to the window
virtual bool TransferToWindow();
// Called to transfer data from the window
virtual bool TransferFromWindow();
wxWindow* GetWindow();
void SetWindow(wxWindow* window);
// validators beep by default if invalid key is pressed, these functions
// allow to change it
static bool IsSilent();
static void SetBellOnError(int doIt = true);
};
//---------------------------------------------------------------------------
%{
IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
%}
class wxPyValidator : public wxValidator {
public:
%pythonAppend wxPyValidator "
self._setCallbackInfo(self, PyValidator, 1)
self._setOORInfo(self)"
wxPyValidator();
void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=true);
};
%immutable;
const wxValidator wxDefaultValidator;
%mutable;
//---------------------------------------------------------------------------