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