File: _validator.i

package info (click to toggle)
wxwidgets2.6 2.6.3.2.1.5%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 83,228 kB
  • ctags: 130,941
  • sloc: cpp: 820,043; ansic: 113,030; python: 107,485; makefile: 42,996; sh: 10,305; lex: 194; yacc: 128; xml: 95; pascal: 74
file content (96 lines) | stat: -rw-r--r-- 2,759 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/////////////////////////////////////////////////////////////////////////////
// Name:        _validator.i
// Purpose:     SWIG interface for wxValidator
//
// Author:      Robin Dunn
//
// Created:     24-June-1997
// RCS-ID:      $Id: _validator.i,v 1.6 2004/09/23 20:23:13 RD Exp $
// 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;
// See also wxPy_ReinitStockObjects in helpers.cpp
const wxValidator wxDefaultValidator;
%mutable;

//---------------------------------------------------------------------------