~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/src/_validator.i

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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: _validator.i 69707 2011-11-08 17:44:35Z RD $
 
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 *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 SuppressBellOnError(bool suppress = true);
 
65
    static void SetBellOnError(int doIt = true);
 
66
 
 
67
    %property(Window, GetWindow, SetWindow, doc="See `GetWindow` and `SetWindow`");
 
68
};
 
69
 
 
70
 
 
71
//---------------------------------------------------------------------------
 
72
%{
 
73
IMP_PYCALLBACK_BOOL_WXWIN(wxPyValidator, wxValidator, Validate);
 
74
IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferToWindow);
 
75
IMP_PYCALLBACK_BOOL_(wxPyValidator, wxValidator, TransferFromWindow);
 
76
 
 
77
IMPLEMENT_DYNAMIC_CLASS(wxPyValidator, wxValidator);
 
78
%}
 
79
 
 
80
 
 
81
class wxPyValidator : public wxValidator {
 
82
public:
 
83
    %pythonAppend wxPyValidator "self._setOORInfo(self);"  setCallbackInfo(PyValidator)
 
84
        
 
85
    wxPyValidator();
 
86
 
 
87
    void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1);
 
88
};
 
89
 
 
90
 
 
91
 
 
92
%immutable;
 
93
const wxValidator wxDefaultValidator;
 
94
%mutable;
 
95
 
 
96
//---------------------------------------------------------------------------