]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _pywindows.i | |
3 | // Purpose: SWIG interface for wxPyControl, See also _pywindows.i | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 2-June-1998 | |
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 | %newgroup | |
18 | ||
19 | ||
d14a1e28 RD |
20 | |
21 | //--------------------------------------------------------------------------- | |
22 | ||
23 | %{ // C++ version of Python aware wxControl | |
24 | class wxPyControl : public wxControl | |
25 | { | |
26 | DECLARE_DYNAMIC_CLASS(wxPyControl) | |
27 | public: | |
28 | wxPyControl() : wxControl() {} | |
29 | wxPyControl(wxWindow* parent, const wxWindowID id, | |
30 | const wxPoint& pos = wxDefaultPosition, | |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = 0, | |
33 | const wxValidator& validator=wxDefaultValidator, | |
34 | const wxString& name = wxPyControlNameStr) | |
35 | : wxControl(parent, id, pos, size, style, validator, name) {} | |
36 | ||
37 | ||
0ef14ca5 RD |
38 | bool DoEraseBackground(wxDC* dc) { |
39 | #ifdef __WXMSW__ | |
40 | return wxWindow::DoEraseBackground(dc->GetHDC()); | |
41 | #else | |
42 | dc->SetBackground(wxBrush(GetBackgroundColour())); | |
43 | dc->Clear(); | |
44 | return true; | |
45 | #endif | |
46 | } | |
47 | ||
d14a1e28 RD |
48 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); |
49 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
50 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
51 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
52 | ||
53 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
54 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
55 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
56 | ||
57 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
58 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
59 | ||
60 | DEC_PYCALLBACK__(InitDialog); | |
61 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
62 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
63 | DEC_PYCALLBACK_BOOL_(Validate); | |
64 | ||
65 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
66 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
67 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
68 | ||
69 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
70 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
71 | ||
1a10485f | 72 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
1a10485f | 73 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
4d2962b1 | 74 | |
b035e80b RD |
75 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
76 | ||
37617433 RD |
77 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
78 | ||
d14a1e28 RD |
79 | PYPRIVATE; |
80 | }; | |
81 | ||
82 | IMPLEMENT_DYNAMIC_CLASS(wxPyControl, wxControl); | |
83 | ||
84 | IMP_PYCALLBACK_VOID_INT4(wxPyControl, wxControl, DoMoveWindow); | |
85 | IMP_PYCALLBACK_VOID_INT5(wxPyControl, wxControl, DoSetSize); | |
86 | IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetClientSize); | |
87 | IMP_PYCALLBACK_VOID_INTINT(wxPyControl, wxControl, DoSetVirtualSize); | |
88 | ||
89 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetSize); | |
90 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetClientSize); | |
91 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyControl, wxControl, DoGetPosition); | |
92 | ||
93 | IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetVirtualSize); | |
94 | IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, DoGetBestSize); | |
95 | ||
96 | IMP_PYCALLBACK__(wxPyControl, wxControl, InitDialog); | |
97 | IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataFromWindow); | |
98 | IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, TransferDataToWindow); | |
99 | IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, Validate); | |
100 | ||
101 | IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocus); | |
102 | IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, AcceptsFocusFromKeyboard); | |
103 | IMP_PYCALLBACK_SIZE_const(wxPyControl, wxControl, GetMaxSize); | |
104 | ||
105 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, AddChild); | |
106 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyControl, wxControl, RemoveChild); | |
107 | ||
1a10485f | 108 | IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, ShouldInheritColours); |
1a10485f | 109 | IMP_PYCALLBACK_VIZATTR_(wxPyControl, wxControl, GetDefaultAttributes); |
b035e80b RD |
110 | |
111 | IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, HasTransparentBackground); | |
37617433 RD |
112 | |
113 | IMP_PYCALLBACK_VOID_(wxPyControl, wxControl, OnInternalIdle); | |
114 | %} | |
d14a1e28 RD |
115 | |
116 | // And now the one for SWIG to see | |
ab1f7d2a | 117 | MustHaveApp(wxPyControl); |
d14a1e28 RD |
118 | class wxPyControl : public wxControl |
119 | { | |
120 | public: | |
2b9048c5 | 121 | %pythonAppend wxPyControl "self._setOORInfo(self); self._setCallbackInfo(self, PyControl)" |
d43da706 | 122 | %pythonAppend wxPyControl() "" |
d14a1e28 | 123 | |
d5573410 | 124 | wxPyControl(wxWindow* parent, const wxWindowID id=-1, |
d14a1e28 RD |
125 | const wxPoint& pos = wxDefaultPosition, |
126 | const wxSize& size = wxDefaultSize, | |
127 | long style = 0, | |
128 | const wxValidator& validator=wxDefaultValidator, | |
129 | const wxString& name = wxPyControlNameStr); | |
130 | ||
1b8c7ba6 | 131 | %RenameCtor(PrePyControl, wxPyControl()); |
d43da706 | 132 | |
d14a1e28 | 133 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
d14a1e28 | 134 | |
0ef14ca5 RD |
135 | bool DoEraseBackground(wxDC* dc); |
136 | ||
a7a01418 RD |
137 | void DoMoveWindow(int x, int y, int width, int height); |
138 | void DoSetSize(int x, int y, int width, int height, | |
d14a1e28 | 139 | int sizeFlags = wxSIZE_AUTO); |
a7a01418 RD |
140 | void DoSetClientSize(int width, int height); |
141 | void DoSetVirtualSize( int x, int y ); | |
d14a1e28 | 142 | |
322913ce | 143 | DocDeclA( |
a7a01418 RD |
144 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
145 | "DoGetSize() -> (width, height)"); | |
322913ce | 146 | DocDeclA( |
a7a01418 RD |
147 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
148 | "DoGetClientSize() -> (width, height)"); | |
322913ce | 149 | DocDeclA( |
a7a01418 RD |
150 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
151 | "DoGetPosition() -> (x,y)"); | |
152 | ||
153 | wxSize DoGetVirtualSize() const; | |
154 | wxSize DoGetBestSize() const; | |
155 | ||
156 | void InitDialog(); | |
157 | bool TransferDataToWindow(); | |
158 | bool TransferDataFromWindow(); | |
159 | bool Validate(); | |
160 | ||
161 | bool AcceptsFocus() const; | |
162 | bool AcceptsFocusFromKeyboard() const; | |
163 | wxSize GetMaxSize() const; | |
164 | ||
165 | void AddChild(wxWindow* child); | |
166 | void RemoveChild(wxWindow* child); | |
167 | ||
168 | bool ShouldInheritColours() const; | |
169 | wxVisualAttributes GetDefaultAttributes(); | |
170 | ||
171 | void OnInternalIdle(); | |
172 | ||
173 | %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow); | |
174 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize); | |
175 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize); | |
176 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize); | |
177 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize); | |
178 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize); | |
179 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition); | |
180 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize); | |
181 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize); | |
182 | %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog); | |
183 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow); | |
184 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow); | |
185 | %MAKE_BASE_FUNC(PyScrolledWindow, Validate); | |
186 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus); | |
187 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard); | |
188 | %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize); | |
189 | %MAKE_BASE_FUNC(PyScrolledWindow, AddChild); | |
190 | %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild); | |
191 | %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours); | |
192 | %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes); | |
193 | %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle); | |
37617433 | 194 | |
d14a1e28 RD |
195 | }; |
196 | ||
197 | ||
198 | //--------------------------------------------------------------------------- | |
199 | //--------------------------------------------------------------------------- |