| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: _pywindows.i |
| 3 | // Purpose: SWIG interface for wxPyWindow, and etc. These classes support |
| 4 | // overriding many of wxWindow's virtual methods in Python derived |
| 5 | // classes. |
| 6 | // |
| 7 | // Author: Robin Dunn |
| 8 | // |
| 9 | // Created: 2-June-1998 |
| 10 | // RCS-ID: $Id$ |
| 11 | // Copyright: (c) 2003 by Total Control Software |
| 12 | // Licence: wxWindows license |
| 13 | ///////////////////////////////////////////////////////////////////////////// |
| 14 | |
| 15 | // Not a %module |
| 16 | |
| 17 | |
| 18 | //--------------------------------------------------------------------------- |
| 19 | %newgroup |
| 20 | |
| 21 | // TODO: Redo these with SWIG directors? |
| 22 | |
| 23 | // TODO: Which (if any?) of these should be done also??? |
| 24 | // Destroy |
| 25 | // DoCaptureMouse |
| 26 | // DoClientToScreen |
| 27 | // DoHitTest |
| 28 | // DoMoveWindow |
| 29 | // DoPopupMenu |
| 30 | // DoReleaseMouse |
| 31 | // DoScreenToClient |
| 32 | // DoSetToolTip |
| 33 | // Enable |
| 34 | // Fit |
| 35 | // GetCharHeight |
| 36 | // GetCharWidth |
| 37 | // GetClientAreaOrigin |
| 38 | // GetDefaultItem |
| 39 | // IsTopLevel |
| 40 | // SetBackgroundColour |
| 41 | // SetDefaultItem |
| 42 | // SetFocus |
| 43 | // SetFocusFromKbd |
| 44 | // SetForegroundColour |
| 45 | // SetSizeHints |
| 46 | // SetVirtualSizeHints |
| 47 | // Show |
| 48 | |
| 49 | |
| 50 | //--------------------------------------------------------------------------- |
| 51 | |
| 52 | %{ // C++ version of Python aware wxWindow |
| 53 | class wxPyWindow : public wxWindow |
| 54 | { |
| 55 | DECLARE_DYNAMIC_CLASS(wxPyWindow) |
| 56 | public: |
| 57 | wxPyWindow() : wxWindow() {} |
| 58 | wxPyWindow(wxWindow* parent, const wxWindowID id, |
| 59 | const wxPoint& pos = wxDefaultPosition, |
| 60 | const wxSize& size = wxDefaultSize, |
| 61 | long style = 0, |
| 62 | const wxString& name = wxPyPanelNameStr) |
| 63 | : wxWindow(parent, id, pos, size, style, name) {} |
| 64 | |
| 65 | void SetBestSize(const wxSize& size) { wxWindow::SetBestSize(size); } |
| 66 | |
| 67 | bool DoEraseBackground(wxDC* dc) { |
| 68 | #ifdef __WXMSW__ |
| 69 | return wxWindow::DoEraseBackground(dc->GetHDC()); |
| 70 | #else |
| 71 | dc->SetBackground(wxBrush(GetBackgroundColour())); |
| 72 | dc->Clear(); |
| 73 | return true; |
| 74 | #endif |
| 75 | } |
| 76 | |
| 77 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); |
| 78 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); |
| 79 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); |
| 80 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); |
| 81 | |
| 82 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); |
| 83 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); |
| 84 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); |
| 85 | |
| 86 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); |
| 87 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); |
| 88 | |
| 89 | DEC_PYCALLBACK__(InitDialog); |
| 90 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); |
| 91 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); |
| 92 | DEC_PYCALLBACK_BOOL_(Validate); |
| 93 | |
| 94 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); |
| 95 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); |
| 96 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); |
| 97 | |
| 98 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); |
| 99 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); |
| 100 | |
| 101 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
| 102 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
| 103 | |
| 104 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
| 105 | |
| 106 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
| 107 | |
| 108 | PYPRIVATE; |
| 109 | }; |
| 110 | |
| 111 | IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow); |
| 112 | |
| 113 | IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow); |
| 114 | IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize); |
| 115 | IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize); |
| 116 | IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize); |
| 117 | |
| 118 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize); |
| 119 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize); |
| 120 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition); |
| 121 | |
| 122 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize); |
| 123 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize); |
| 124 | |
| 125 | IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog); |
| 126 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow); |
| 127 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow); |
| 128 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate); |
| 129 | |
| 130 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus); |
| 131 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard); |
| 132 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize); |
| 133 | |
| 134 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild); |
| 135 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild); |
| 136 | |
| 137 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, ShouldInheritColours); |
| 138 | IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes); |
| 139 | |
| 140 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, HasTransparentBackground); |
| 141 | |
| 142 | IMP_PYCALLBACK_VOID_(wxPyWindow, wxWindow, OnInternalIdle); |
| 143 | %} |
| 144 | |
| 145 | // And now the one for SWIG to see |
| 146 | MustHaveApp(wxPyWindow); |
| 147 | class wxPyWindow : public wxWindow |
| 148 | { |
| 149 | public: |
| 150 | %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)" |
| 151 | %pythonAppend wxPyWindow() "" |
| 152 | |
| 153 | wxPyWindow(wxWindow* parent, const wxWindowID id=-1, |
| 154 | const wxPoint& pos = wxDefaultPosition, |
| 155 | const wxSize& size = wxDefaultSize, |
| 156 | long style = 0, |
| 157 | const wxString& name = wxPyPanelNameStr); |
| 158 | |
| 159 | %RenameCtor(PrePyWindow, wxPyWindow()); |
| 160 | |
| 161 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
| 162 | |
| 163 | void SetBestSize(const wxSize& size); |
| 164 | bool DoEraseBackground(wxDC* dc); |
| 165 | |
| 166 | void DoMoveWindow(int x, int y, int width, int height); |
| 167 | void DoSetSize(int x, int y, int width, int height, |
| 168 | int sizeFlags = wxSIZE_AUTO); |
| 169 | void DoSetClientSize(int width, int height); |
| 170 | void DoSetVirtualSize( int x, int y ); |
| 171 | |
| 172 | DocDeclA( |
| 173 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
| 174 | "DoGetSize() -> (width, height)"); |
| 175 | DocDeclA( |
| 176 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
| 177 | "DoGetClientSize() -> (width, height)"); |
| 178 | DocDeclA( |
| 179 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
| 180 | "DoGetPosition() -> (x,y)"); |
| 181 | |
| 182 | wxSize DoGetVirtualSize() const; |
| 183 | wxSize DoGetBestSize() const; |
| 184 | |
| 185 | void InitDialog(); |
| 186 | bool TransferDataToWindow(); |
| 187 | bool TransferDataFromWindow(); |
| 188 | bool Validate(); |
| 189 | |
| 190 | bool AcceptsFocus() const; |
| 191 | bool AcceptsFocusFromKeyboard() const; |
| 192 | wxSize GetMaxSize() const; |
| 193 | |
| 194 | void AddChild(wxWindow* child); |
| 195 | void RemoveChild(wxWindow* child); |
| 196 | |
| 197 | bool ShouldInheritColours() const; |
| 198 | wxVisualAttributes GetDefaultAttributes(); |
| 199 | |
| 200 | void OnInternalIdle(); |
| 201 | |
| 202 | %MAKE_BASE_FUNC(PyWindow, DoMoveWindow); |
| 203 | %MAKE_BASE_FUNC(PyWindow, DoSetSize); |
| 204 | %MAKE_BASE_FUNC(PyWindow, DoSetClientSize); |
| 205 | %MAKE_BASE_FUNC(PyWindow, DoSetVirtualSize); |
| 206 | %MAKE_BASE_FUNC(PyWindow, DoGetSize); |
| 207 | %MAKE_BASE_FUNC(PyWindow, DoGetClientSize); |
| 208 | %MAKE_BASE_FUNC(PyWindow, DoGetPosition); |
| 209 | %MAKE_BASE_FUNC(PyWindow, DoGetVirtualSize); |
| 210 | %MAKE_BASE_FUNC(PyWindow, DoGetBestSize); |
| 211 | %MAKE_BASE_FUNC(PyWindow, InitDialog); |
| 212 | %MAKE_BASE_FUNC(PyWindow, TransferDataToWindow); |
| 213 | %MAKE_BASE_FUNC(PyWindow, TransferDataFromWindow); |
| 214 | %MAKE_BASE_FUNC(PyWindow, Validate); |
| 215 | %MAKE_BASE_FUNC(PyWindow, AcceptsFocus); |
| 216 | %MAKE_BASE_FUNC(PyWindow, AcceptsFocusFromKeyboard); |
| 217 | %MAKE_BASE_FUNC(PyWindow, GetMaxSize); |
| 218 | %MAKE_BASE_FUNC(PyWindow, AddChild); |
| 219 | %MAKE_BASE_FUNC(PyWindow, RemoveChild); |
| 220 | %MAKE_BASE_FUNC(PyWindow, ShouldInheritColours); |
| 221 | %MAKE_BASE_FUNC(PyWindow, GetDefaultAttributes); |
| 222 | %MAKE_BASE_FUNC(PyWindow, OnInternalIdle); |
| 223 | |
| 224 | }; |
| 225 | |
| 226 | //--------------------------------------------------------------------------- |
| 227 | // Do the same thing for wxControl |
| 228 | |
| 229 | // ** See _pycontrol.i, it was moved there because of dependency on wxControl |
| 230 | |
| 231 | |
| 232 | //--------------------------------------------------------------------------- |
| 233 | // and for wxPanel |
| 234 | |
| 235 | %{ // C++ version of Python aware wxPanel |
| 236 | class wxPyPanel : public wxPanel |
| 237 | { |
| 238 | DECLARE_DYNAMIC_CLASS(wxPyPanel) |
| 239 | public: |
| 240 | wxPyPanel() : wxPanel() {} |
| 241 | wxPyPanel(wxWindow* parent, const wxWindowID id, |
| 242 | const wxPoint& pos = wxDefaultPosition, |
| 243 | const wxSize& size = wxDefaultSize, |
| 244 | long style = 0, |
| 245 | const wxString& name = wxPyPanelNameStr) |
| 246 | : wxPanel(parent, id, pos, size, style, name) {} |
| 247 | |
| 248 | void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); } |
| 249 | bool DoEraseBackground(wxDC* dc) { |
| 250 | #ifdef __WXMSW__ |
| 251 | return wxWindow::DoEraseBackground(dc->GetHDC()); |
| 252 | #else |
| 253 | dc->SetBackground(wxBrush(GetBackgroundColour())); |
| 254 | dc->Clear(); |
| 255 | return true; |
| 256 | #endif |
| 257 | } |
| 258 | |
| 259 | |
| 260 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); |
| 261 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); |
| 262 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); |
| 263 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); |
| 264 | |
| 265 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); |
| 266 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); |
| 267 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); |
| 268 | |
| 269 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); |
| 270 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); |
| 271 | |
| 272 | DEC_PYCALLBACK__(InitDialog); |
| 273 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); |
| 274 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); |
| 275 | DEC_PYCALLBACK_BOOL_(Validate); |
| 276 | |
| 277 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); |
| 278 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); |
| 279 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); |
| 280 | |
| 281 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); |
| 282 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); |
| 283 | |
| 284 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
| 285 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
| 286 | |
| 287 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
| 288 | |
| 289 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
| 290 | |
| 291 | PYPRIVATE; |
| 292 | }; |
| 293 | |
| 294 | IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel); |
| 295 | |
| 296 | IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow); |
| 297 | IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize); |
| 298 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize); |
| 299 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize); |
| 300 | |
| 301 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize); |
| 302 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize); |
| 303 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition); |
| 304 | |
| 305 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize); |
| 306 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize); |
| 307 | |
| 308 | IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog); |
| 309 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow); |
| 310 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow); |
| 311 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate); |
| 312 | |
| 313 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus); |
| 314 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard); |
| 315 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize); |
| 316 | |
| 317 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild); |
| 318 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild); |
| 319 | |
| 320 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours); |
| 321 | IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes); |
| 322 | |
| 323 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, HasTransparentBackground); |
| 324 | |
| 325 | IMP_PYCALLBACK_VOID_(wxPyPanel, wxPanel, OnInternalIdle); |
| 326 | %} |
| 327 | |
| 328 | // And now the one for SWIG to see |
| 329 | MustHaveApp(wxPyPanel); |
| 330 | class wxPyPanel : public wxPanel |
| 331 | { |
| 332 | public: |
| 333 | %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)" |
| 334 | %pythonAppend wxPyPanel() "" |
| 335 | |
| 336 | wxPyPanel(wxWindow* parent, const wxWindowID id=-1, |
| 337 | const wxPoint& pos = wxDefaultPosition, |
| 338 | const wxSize& size = wxDefaultSize, |
| 339 | long style = 0, |
| 340 | const wxString& name = wxPyPanelNameStr); |
| 341 | |
| 342 | %RenameCtor(PrePyPanel, wxPyPanel()); |
| 343 | |
| 344 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
| 345 | |
| 346 | void SetBestSize(const wxSize& size); |
| 347 | bool DoEraseBackground(wxDC* dc); |
| 348 | |
| 349 | void DoMoveWindow(int x, int y, int width, int height); |
| 350 | void DoSetSize(int x, int y, int width, int height, |
| 351 | int sizeFlags = wxSIZE_AUTO); |
| 352 | void DoSetClientSize(int width, int height); |
| 353 | void DoSetVirtualSize( int x, int y ); |
| 354 | |
| 355 | DocDeclA( |
| 356 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
| 357 | "DoGetSize() -> (width, height)"); |
| 358 | DocDeclA( |
| 359 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
| 360 | "DoGetClientSize() -> (width, height)"); |
| 361 | DocDeclA( |
| 362 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
| 363 | "DoGetPosition() -> (x,y)"); |
| 364 | |
| 365 | wxSize DoGetVirtualSize() const; |
| 366 | wxSize DoGetBestSize() const; |
| 367 | |
| 368 | void InitDialog(); |
| 369 | bool TransferDataToWindow(); |
| 370 | bool TransferDataFromWindow(); |
| 371 | bool Validate(); |
| 372 | |
| 373 | bool AcceptsFocus() const; |
| 374 | bool AcceptsFocusFromKeyboard() const; |
| 375 | wxSize GetMaxSize() const; |
| 376 | |
| 377 | void AddChild(wxWindow* child); |
| 378 | void RemoveChild(wxWindow* child); |
| 379 | |
| 380 | bool ShouldInheritColours() const ; |
| 381 | wxVisualAttributes GetDefaultAttributes(); |
| 382 | |
| 383 | void OnInternalIdle(); |
| 384 | |
| 385 | %MAKE_BASE_FUNC(PyPanel, DoMoveWindow); |
| 386 | %MAKE_BASE_FUNC(PyPanel, DoSetSize); |
| 387 | %MAKE_BASE_FUNC(PyPanel, DoSetClientSize); |
| 388 | %MAKE_BASE_FUNC(PyPanel, DoSetVirtualSize); |
| 389 | %MAKE_BASE_FUNC(PyPanel, DoGetSize); |
| 390 | %MAKE_BASE_FUNC(PyPanel, DoGetClientSize); |
| 391 | %MAKE_BASE_FUNC(PyPanel, DoGetPosition); |
| 392 | %MAKE_BASE_FUNC(PyPanel, DoGetVirtualSize); |
| 393 | %MAKE_BASE_FUNC(PyPanel, DoGetBestSize); |
| 394 | %MAKE_BASE_FUNC(PyPanel, InitDialog); |
| 395 | %MAKE_BASE_FUNC(PyPanel, TransferDataToWindow); |
| 396 | %MAKE_BASE_FUNC(PyPanel, TransferDataFromWindow); |
| 397 | %MAKE_BASE_FUNC(PyPanel, Validate); |
| 398 | %MAKE_BASE_FUNC(PyPanel, AcceptsFocus); |
| 399 | %MAKE_BASE_FUNC(PyPanel, AcceptsFocusFromKeyboard); |
| 400 | %MAKE_BASE_FUNC(PyPanel, GetMaxSize); |
| 401 | %MAKE_BASE_FUNC(PyPanel, AddChild); |
| 402 | %MAKE_BASE_FUNC(PyPanel, RemoveChild); |
| 403 | %MAKE_BASE_FUNC(PyPanel, ShouldInheritColours); |
| 404 | %MAKE_BASE_FUNC(PyPanel, GetDefaultAttributes); |
| 405 | %MAKE_BASE_FUNC(PyPanel, OnInternalIdle); |
| 406 | }; |
| 407 | |
| 408 | //--------------------------------------------------------------------------- |
| 409 | // and for wxScrolledWindow |
| 410 | |
| 411 | %{ // C++ version of Python aware wxScrolledWindow |
| 412 | class wxPyScrolledWindow : public wxScrolledWindow |
| 413 | { |
| 414 | DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow) |
| 415 | public: |
| 416 | wxPyScrolledWindow() : wxScrolledWindow() {} |
| 417 | wxPyScrolledWindow(wxWindow* parent, const wxWindowID id, |
| 418 | const wxPoint& pos = wxDefaultPosition, |
| 419 | const wxSize& size = wxDefaultSize, |
| 420 | long style = 0, |
| 421 | const wxString& name = wxPyPanelNameStr) |
| 422 | : wxScrolledWindow(parent, id, pos, size, style, name) {} |
| 423 | |
| 424 | void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); } |
| 425 | bool DoEraseBackground(wxDC* dc) { |
| 426 | #ifdef __WXMSW__ |
| 427 | return wxWindow::DoEraseBackground(dc->GetHDC()); |
| 428 | #else |
| 429 | dc->SetBackground(wxBrush(GetBackgroundColour())); |
| 430 | dc->Clear(); |
| 431 | return true; |
| 432 | #endif |
| 433 | } |
| 434 | |
| 435 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); |
| 436 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); |
| 437 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); |
| 438 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); |
| 439 | |
| 440 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); |
| 441 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); |
| 442 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); |
| 443 | |
| 444 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); |
| 445 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); |
| 446 | |
| 447 | DEC_PYCALLBACK__(InitDialog); |
| 448 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); |
| 449 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); |
| 450 | DEC_PYCALLBACK_BOOL_(Validate); |
| 451 | |
| 452 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); |
| 453 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); |
| 454 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); |
| 455 | |
| 456 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); |
| 457 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); |
| 458 | |
| 459 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
| 460 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
| 461 | |
| 462 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
| 463 | |
| 464 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
| 465 | |
| 466 | PYPRIVATE; |
| 467 | }; |
| 468 | |
| 469 | IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow); |
| 470 | |
| 471 | IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow); |
| 472 | IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize); |
| 473 | IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize); |
| 474 | IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize); |
| 475 | |
| 476 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize); |
| 477 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize); |
| 478 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition); |
| 479 | |
| 480 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize); |
| 481 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize); |
| 482 | |
| 483 | IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog); |
| 484 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow); |
| 485 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow); |
| 486 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate); |
| 487 | |
| 488 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus); |
| 489 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard); |
| 490 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize); |
| 491 | |
| 492 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild); |
| 493 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild); |
| 494 | |
| 495 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours); |
| 496 | IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes); |
| 497 | |
| 498 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, HasTransparentBackground); |
| 499 | |
| 500 | IMP_PYCALLBACK_VOID_(wxPyScrolledWindow, wxScrolledWindow, OnInternalIdle); |
| 501 | %} |
| 502 | |
| 503 | // And now the one for SWIG to see |
| 504 | MustHaveApp(wxPyScrolledWindow); |
| 505 | class wxPyScrolledWindow : public wxScrolledWindow |
| 506 | { |
| 507 | public: |
| 508 | %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyScrolledWindow)" |
| 509 | %pythonAppend wxPyScrolledWindow() "" |
| 510 | |
| 511 | wxPyScrolledWindow(wxWindow* parent, const wxWindowID id=-1, |
| 512 | const wxPoint& pos = wxDefaultPosition, |
| 513 | const wxSize& size = wxDefaultSize, |
| 514 | long style = 0, |
| 515 | const wxString& name = wxPyPanelNameStr); |
| 516 | |
| 517 | %RenameCtor(PrePyScrolledWindow, wxPyScrolledWindow()); |
| 518 | |
| 519 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
| 520 | |
| 521 | void SetBestSize(const wxSize& size); |
| 522 | bool DoEraseBackground(wxDC* dc); |
| 523 | |
| 524 | void DoMoveWindow(int x, int y, int width, int height); |
| 525 | void DoSetSize(int x, int y, int width, int height, |
| 526 | int sizeFlags = wxSIZE_AUTO); |
| 527 | void DoSetClientSize(int width, int height); |
| 528 | void DoSetVirtualSize( int x, int y ); |
| 529 | |
| 530 | DocDeclA( |
| 531 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
| 532 | "DoGetSize() -> (width, height)"); |
| 533 | DocDeclA( |
| 534 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
| 535 | "DoGetClientSize() -> (width, height)"); |
| 536 | DocDeclA( |
| 537 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
| 538 | "DoGetPosition() -> (x,y)"); |
| 539 | |
| 540 | wxSize DoGetVirtualSize() const; |
| 541 | wxSize DoGetBestSize() const; |
| 542 | |
| 543 | void InitDialog(); |
| 544 | bool TransferDataToWindow(); |
| 545 | bool TransferDataFromWindow(); |
| 546 | bool Validate(); |
| 547 | |
| 548 | bool AcceptsFocus() const; |
| 549 | bool AcceptsFocusFromKeyboard() const; |
| 550 | wxSize GetMaxSize() const; |
| 551 | |
| 552 | void AddChild(wxWindow* child); |
| 553 | void RemoveChild(wxWindow* child); |
| 554 | |
| 555 | bool ShouldInheritColours() const; |
| 556 | wxVisualAttributes GetDefaultAttributes(); |
| 557 | |
| 558 | void OnInternalIdle(); |
| 559 | |
| 560 | %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow); |
| 561 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize); |
| 562 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize); |
| 563 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize); |
| 564 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize); |
| 565 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize); |
| 566 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition); |
| 567 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize); |
| 568 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize); |
| 569 | %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog); |
| 570 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow); |
| 571 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow); |
| 572 | %MAKE_BASE_FUNC(PyScrolledWindow, Validate); |
| 573 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus); |
| 574 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard); |
| 575 | %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize); |
| 576 | %MAKE_BASE_FUNC(PyScrolledWindow, AddChild); |
| 577 | %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild); |
| 578 | %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours); |
| 579 | %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes); |
| 580 | %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle); |
| 581 | |
| 582 | }; |
| 583 | |
| 584 | |
| 585 | //--------------------------------------------------------------------------- |
| 586 | //--------------------------------------------------------------------------- |