/usr/include/wx-3.0/wx/wxPython/i_files/aui.i is in python-wxgtk3.0-dev 3.0.2.0+dfsg-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | /////////////////////////////////////////////////////////////////////////////
// Name: aui.i
// Purpose: Wrappers for the wxAUI classes.
//
// Author: Robin Dunn
//
// Created: 5-July-2006
// RCS-ID: $Id$
// Copyright: (c) 2006 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
%define DOCSTRING
"The wx.aui module is an Advanced User Interface library that aims to
implement \"cutting-edge\" interface usability and design features so
developers can quickly and easily create beautiful and usable
application interfaces.
**Vision and Design Principles**
wx.aui attempts to encapsulate the following aspects of the user
interface:
* Frame Management: Frame management provides the means to open,
move and hide common controls that are needed to interact with the
document, and allow these configurations to be saved into
different perspectives and loaded at a later time.
* Toolbars: Toolbars are a specialized subset of the frame
management system and should behave similarly to other docked
components. However, they also require additional functionality,
such as \"spring-loaded\" rebar support, \"chevron\" buttons and
end-user customizability.
* Modeless Controls: Modeless controls expose a tool palette or set
of options that float above the application content while allowing
it to be accessed. Usually accessed by the toolbar, these controls
disappear when an option is selected, but may also be \"torn off\"
the toolbar into a floating frame of their own.
* Look and Feel: Look and feel encompasses the way controls are
drawn, both when shown statically as well as when they are being
moved. This aspect of user interface design incorporates \"special
effects\" such as transparent window dragging as well as frame
animation.
**wx.aui adheres to the following principles**
- Use native floating frames to obtain a native look and feel for
all platforms;
- Use existing wxPython code where possible, such as sizer
implementation for frame management;
- Use standard wxPython coding conventions.
**Usage**
The following example shows a simple implementation that utilizes
`wx.aui.AuiManager` to manage three text controls in a frame window::
import wx
import wx.aui
class MyFrame(wx.Frame):
def __init__(self, parent, id=-1, title='wx.aui Test',
pos=wx.DefaultPosition, size=(800, 600),
style=wx.DEFAULT_FRAME_STYLE):
wx.Frame.__init__(self, parent, id, title, pos, size, style)
self._mgr = wx.aui.AuiManager(self)
# create several text controls
text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
text3 = wx.TextCtrl(self, -1, 'Main content window',
wx.DefaultPosition, wx.Size(200,150),
wx.NO_BORDER | wx.TE_MULTILINE)
# add the panes to the manager
self._mgr.AddPane(text1, wx.LEFT, 'Pane Number One')
self._mgr.AddPane(text2, wx.BOTTOM, 'Pane Number Two')
self._mgr.AddPane(text3, wx.CENTER)
# tell the manager to 'commit' all the changes just made
self._mgr.Update()
self.Bind(wx.EVT_CLOSE, self.OnClose)
def OnClose(self, event):
# deinitialize the frame manager
self._mgr.UnInit()
# delete the frame
self.Destroy()
app = wx.App()
frame = MyFrame(None)
frame.Show()
app.MainLoop()
"
%enddef
%module(package="wx", docstring=DOCSTRING) aui
%{
#include "wx/wxPython/wxPython.h"
#include "wx/wxPython/pyclasses.h"
#include <wx/aui/aui.h>
#define NO_IMAGE -1
%}
//---------------------------------------------------------------------------
%import core.i
%import windows.i
%pythoncode { wx = _core }
%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
%include _aui_docstrings.i
//---------------------------------------------------------------------------
// TODO: This should be moved to its own module, but this is the only place
// it is needed so far.
template <class W>
class wxNavigationEnabled : public W
{
public:
//wxNavigationEnabled();
//virtual bool AcceptsFocus() const;
//virtual bool AcceptsFocusRecursively() const;
//virtual bool AcceptsFocusFromKeyboard() const;
//virtual void AddChild(wxWindowBase *child);
//virtual void RemoveChild(wxWindowBase *child);
//virtual void SetFocus();
//void SetFocusIgnoringChildren();
//void AcceptFocus(bool acceptFocus);
};
%rename(wxNavigationEnabled_BookCtrlBase) wxNavigationEnabled<wxBookCtrlBase>;
%template(wxNavigationEnabled_BookCtrlBase) wxNavigationEnabled<wxBookCtrlBase>;
//---------------------------------------------------------------------------
// Preprocessor stuff so SWIG doesn't get confused when %include-ing
// the aui .h files.
%ignore wxUSE_AUI;
%ignore wxUSE_MENUS;
%ignore wxABI_VERSION;
#define wxUSE_AUI 1
#define wxUSE_MENUS 1
#define wxABI_VERSION 99999
#define WXDLLIMPEXP_AUI
#define WXDLLIMPEXP_FWD_AUI
#define WXDLLIMPEXP_FWD_CORE
#define unsigned
#define wxDEPRECATED(decl)
#define DECLARE_EVENT_TABLE()
#define DECLARE_CLASS(foo)
#define DECLARE_DYNAMIC_CLASS(foo)
#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(foo)
// We'll skip making wrappers for these, they have overloads that take a
// wxSize or wxPoint
%ignore wxAuiPaneInfo::MaxSize(int x, int y);
%ignore wxAuiPaneInfo::MinSize(int x, int y);
%ignore wxAuiPaneInfo::BestSize(int x, int y);
%ignore wxAuiPaneInfo::FloatingPosition(int x, int y);
%ignore wxAuiPaneInfo::FloatingSize(int x, int y);
// But for these we will do the overloading (see %pythoncode below) so let's
// rename the C++ versions
%rename(_GetPaneByWidget) wxAuiManager::GetPane(wxWindow* window);
%rename(_GetPaneByName) wxAuiManager::GetPane(const wxString& name);
%rename(_AddPane1) wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
%rename(_AddPane2) wxAuiManager::AddPane(wxWindow* window, int direction = wxLEFT,
const wxString& caption = wxEmptyString);
%rename(AddPaneAtPos) wxAuiManager::AddPane(wxWindow* window,
const wxPaneInfo& pane_info,
const wxPoint& drop_pos);
// A typemap for the return value of wxAuiManager::GetAllPanes
%typemap(out) wxAuiPaneInfoArray& {
$result = PyList_New(0);
for (size_t i=0; i < $1->GetCount(); i++) {
PyObject* pane_obj = SWIG_NewPointerObj((void*)(&$1->Item(i)), SWIGTYPE_p_wxAuiPaneInfo, 0);
PyList_Append($result, pane_obj);
}
}
//%ignore wxAuiManager::~wxAuiManager;
%nokwargs wxAuiTabContainer::SetActivePage;
%pythonAppend wxAuiTabCtrl::wxAuiTabCtrl "self._setOORInfo(self)";
%pythonAppend wxAuiNotebook::wxAuiNotebook "self._setOORInfo(self)";
%pythonAppend wxAuiNotebook::wxAuiNotebook() "val._setOORInfo(val)";
%ignore wxAuiNotebook::~wxAuiNotebook;
%rename(PreAuiNotebook) wxAuiNotebook::wxAuiNotebook();
// NB: Since we can't target the use of a typemap to specific methods make
// sure to check that the disown is only applied where it is expected...
%disownarg( wxAuiDockArt* art_provider );
%disownarg( wxAuiTabArt* art );
// Link error...
%ignore wxAuiDefaultTabArt::SetWindow;
//---------------------------------------------------------------------------
// We need an %extend version of these methods to deal with the output
// parameters
%ignore wxAuiTabArt::DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent);
%ignore wxAuiDefaultTabArt::DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent);
%ignore wxAuiTabArt::DrawButton(wxDC& dc,
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
int orientation,
wxRect* out_rect);
%ignore wxAuiDefaultTabArt::DrawButton(wxDC& dc,
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
int orientation,
wxRect* out_rect);
%ignore wxAuiTabArt::GetTabSize(wxDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool active,
int close_button_state,
int* x_extent);
%ignore wxAuiDefaultTabArt::GetTabSize(wxDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool active,
int close_button_state,
int* x_extent);
//---------------------------------------------------------------------------
// ignore this overload
%ignore wxAuiTabContainer::GetPage(size_t idx) const;
%pythonAppend wxAuiMDIParentFrame::wxAuiMDIParentFrame "self._setOORInfo(self)";
%pythonAppend wxAuiMDIParentFrame::wxAuiMDIParentFrame() "val._setOORInfo(val)";
%ignore wxAuiMDIParentFrame::~wxAuiMDIParentFrame;
%rename(PreAuiMDIParentFrame) wxAuiMDIParentFrame::wxAuiMDIParentFrame();
// Ignore these for now because they need a typemap for the return value, see below.
%ignore wxAuiMDIParentFrame::GetNotebook;
%ignore wxAuiMDIParentFrame::GetActiveChild;
%ignore wxAuiMDIParentFrame::GetClientWindow;
%pythonAppend wxAuiMDIChildFrame::wxAuiMDIChildFrame "self._setOORInfo(self)";
%pythonAppend wxAuiMDIChildFrame::wxAuiMDIChildFrame() "val._setOORInfo(val)";
%ignore wxAuiMDIChildFrame::~wxAuiMDIChildFrame;
%rename(PreAuiMDIChildFrame) wxAuiMDIChildFrame::wxAuiMDIChildFrame();
%pythonAppend wxAuiMDIClientWindow::wxAuiMDIClientWindow "self._setOORInfo(self)";
%pythonAppend wxAuiMDIClientWindow::wxAuiMDIClientWindow() "val._setOORInfo(val)";
%ignore wxAuiMDIClientWindow::~wxAuiMDIClientWindow;
%rename(PreAuiMDIClientWindow) wxAuiMDIClientWindow::wxAuiMDIClientWindow();
%typemap(out) wxEvtHandler* { $result = wxPyMake_wxObject($1, $owner); }
%nokwargs wxAuiToolBarItem;
%nokwargs wxAuiToolBar::SetMargins;
//---------------------------------------------------------------------------
// Get all our defs from the REAL header files.
#define wxColor wxColour // fix problem in dockart.h
%include framemanager.h
%include dockart.h
%include floatpane.h
%include auibook.h
%include tabmdi.h
%include auibar.h
%include tabart.h
#undef wxColor
//---------------------------------------------------------------------------
// Methods to inject into the AuiManager class that will sort out calls to
// the overloaded versions of GetPane and AddPane
%extend wxAuiManager {
%pythoncode {
def GetPane(self, item):
"""
GetPane(self, window_or_info item) -> PaneInfo
GetPane is used to search for a `PaneInfo` object either by
widget reference or by pane name, which acts as a unique id
for a window pane. The returned `PaneInfo` object may then be
modified to change a pane's look, state or position. After one
or more modifications to the `PaneInfo`, `AuiManager.Update`
should be called to realize the changes to the user interface.
If the lookup failed (meaning the pane could not be found in
the manager) GetPane returns an empty `PaneInfo`, a condition
which can be checked by calling `PaneInfo.IsOk`.
"""
if isinstance(item, wx.Window):
return self._GetPaneByWidget(item)
else:
return self._GetPaneByName(item)
def AddPane(self, window, info=None, caption=None):
"""
AddPane(self, window, info=None, caption=None) -> bool
AddPane tells the frame manager to start managing a child
window. There are two versions of this function. The first
verison accepts a `PaneInfo` object for the ``info`` parameter
and allows the full spectrum of pane parameter
possibilities. (Say that 3 times fast!)
The second version is used for simpler user interfaces which
do not require as much configuration. In this case the
``info`` parameter specifies the direction property of the
pane info, and defaults to ``wx.LEFT``. The pane caption may
also be specified as an extra parameter in this form.
"""
if type(info) == AuiPaneInfo:
return self._AddPane1(window, info)
else:
# This Is AddPane2
if info is None:
info = wx.LEFT
if caption is None:
caption = ""
return self._AddPane2(window, info, caption)
}
// For backwards compatibility
%pythoncode {
SetFrame = wx.deprecated(SetManagedWindow,
"SetFrame is deprecated, use `SetManagedWindow` instead.")
GetFrame = wx.deprecated(GetManagedWindow,
"GetFrame is deprecated, use `GetManagedWindow` instead.")
}
}
%extend wxAuiDockInfo {
~wxAuiDockInfo() {}
}
%extend wxAuiDockUIPart {
~wxAuiDockUIPart() {}
}
%extend wxAuiPaneButton {
~wxAuiPaneButton() {}
}
%extend wxAuiMDIParentFrame {
%typemap(out) wxAuiNotebook* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxAuiMDIChildFrame* { $result = wxPyMake_wxObject($1, $owner); }
%typemap(out) wxAuiMDIClientWindow* { $result = wxPyMake_wxObject($1, $owner); }
%rename(GetNotebook) _GetNotebook;
%rename(GetActiveChild) _GetActiveChild;
%rename(GetClientWindow) _GetClientWindow;
wxAuiNotebook* _GetNotebook() const
{
return self->GetNotebook();
}
wxAuiMDIChildFrame* _GetActiveChild() const
{
return self->GetActiveChild();
}
wxAuiMDIClientWindow* _GetClientWindow() const
{
return self->GetClientWindow();
}
%typemap(out) wxAuiNotebook*;
%typemap(out) wxAuiMDIChildFrame*;
%typemap(out) wxAuiMDIClientWindow*;
}
//---------------------------------------------------------------------------
%{
// A wxDocArt class that knows how to forward virtuals to Python methods
class wxPyAuiDockArt : public wxAuiDefaultDockArt
{
public:
wxPyAuiDockArt() : wxAuiDefaultDockArt() {}
DEC_PYCALLBACK_INT_INT(GetMetric);
DEC_PYCALLBACK_VOID_INTINT(SetMetric);
DEC_PYCALLBACK__INTFONT(SetFont);
DEC_PYCALLBACK_FONT_INT(GetFont);
DEC_PYCALLBACK_COLOUR_INT(GetColour);
DEC_PYCALLBACK__INTCOLOUR(SetColour);
virtual void DrawSash(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawSash"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
odc, owin, orientation, orect));
Py_DECREF(odc);
Py_DECREF(owin);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawSash(dc, window, orientation, rect);
}
virtual void DrawBackground(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawBackground"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
odc, owin, orientation, orect));
Py_DECREF(odc);
Py_DECREF(owin);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawBackground(dc, window, orientation, rect);
}
virtual void DrawCaption(wxDC& dc,
wxWindow* window,
const wxString& text,
const wxRect& rect,
wxAuiPaneInfo& pane)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawCaption"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* otext = wx2PyString(text);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOO)",
odc, owin, otext, orect, opane));
Py_DECREF(odc);
Py_DECREF(owin);
Py_DECREF(otext);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawCaption(dc, window, text, rect, pane);
}
virtual void DrawGripper(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxAuiPaneInfo& pane)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawGripper"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOO)", odc, owin, orect, opane));
Py_DECREF(odc);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawGripper(dc, window, rect, pane);
}
virtual void DrawBorder(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxAuiPaneInfo& pane)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawBorder"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, orect, opane));
Py_DECREF(odc);
Py_DECREF(owin);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawBorder(dc, window, rect, pane);
}
virtual void DrawPaneButton(wxDC& dc,
wxWindow* window,
int button,
int button_state,
const wxRect& rect,
wxAuiPaneInfo& pane)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawPaneButton"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiIOO)",
odc, owin, button, button_state,
orect, opane));
Py_DECREF(odc);
Py_DECREF(owin);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultDockArt::DrawPaneButton(dc, window, button, button_state, rect, pane);
}
PYPRIVATE;
};
IMP_PYCALLBACK_INT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetMetric);
IMP_PYCALLBACK_VOID_INTINT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetMetric);
IMP_PYCALLBACK__INTFONT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetFont);
IMP_PYCALLBACK_FONT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetFont);
IMP_PYCALLBACK_COLOUR_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetColour);
IMP_PYCALLBACK__INTCOLOUR(wxPyAuiDockArt, wxAuiDefaultDockArt, SetColour);
%}
DocStr(wxPyAuiDockArt,
"This version of the `AuiDockArt` class has been instrumented to be
subclassable in Python and to reflect all calls to the C++ base class
methods to the Python methods implemented in the derived class.", "");
class wxPyAuiDockArt : public wxAuiDefaultDockArt
{
public:
%pythonAppend wxPyAuiDockArt setCallbackInfo(PyAuiDockArt)
wxPyAuiDockArt();
void _setCallbackInfo(PyObject* self, PyObject* _class);
};
//---------------------------------------------------------------------------
%extend wxAuiTabContainer {
%property(ActivePage, GetActivePage, SetActivePage, doc="See `GetActivePage` and `SetActivePage`");
%property(PageCount, GetPageCount, doc="See `GetPageCount`");
%property(Pages, GetPages, doc="See `GetPages`");
}
%extend wxAuiManager {
%property(AllPanes, GetAllPanes, doc="See `GetAllPanes`");
%property(ArtProvider, GetArtProvider, SetArtProvider, doc="See `GetArtProvider` and `SetArtProvider`");
%property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
%property(ManagedWindow, GetManagedWindow, SetManagedWindow, doc="See `GetManagedWindow` and `SetManagedWindow`");
}
%extend wxAuiManagerEvent {
%property(Button, GetButton, SetButton, doc="See `GetButton` and `SetButton`");
%property(DC, GetDC, SetDC, doc="See `GetDC` and `SetDC`");
%property(Pane, GetPane, SetPane, doc="See `GetPane` and `SetPane`");
}
//---------------------------------------------------------------------------
%extend wxAuiTabArt {
// Provide an alternate implementation for some of the wxAuiTabArt methods
// that have output parameters
PyObject* DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& in_rect,
int close_button_state)
{
wxRect* tab_rect = new wxRect;
wxRect* button_rect = new wxRect;
int x_extent;
self->DrawTab(dc, wnd, pane, in_rect, close_button_state,
tab_rect, button_rect, &x_extent);
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(3);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject((void*)tab_rect, wxT("wxRect"), true));
PyTuple_SET_ITEM(tup, 1, wxPyConstructObject((void*)button_rect, wxT("wxRect"), true));
PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(x_extent));
wxPyEndBlockThreads(blocked);
return tup;
}
PyObject* DrawButton( wxDC& dc,
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
int orientation)
{
wxRect* rect = new wxRect;
self->DrawButton(dc, wnd, in_rect, bitmap_id, button_state, orientation, rect);
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* orect = wxPyConstructObject((void*)rect, wxT("wxRect"), true);
wxPyEndBlockThreads(blocked);
return orect;
}
PyObject* GetTabSize( wxDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool active,
int close_button_state)
{
wxSize* sz = new wxSize;
int x_extent;
*sz = self->GetTabSize(dc, wnd, caption, bitmap, active,
close_button_state, &x_extent);
wxPyBlock_t blocked = wxPyBeginBlockThreads();
PyObject* tup = PyTuple_New(2);
PyTuple_SET_ITEM(tup, 0, wxPyConstructObject((void*)sz, wxT("wxSize"), true));
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(x_extent));
wxPyEndBlockThreads(blocked);
return tup;
}
}
%{
// A wxTabArt class that knows how to forward virtuals to Python methods
class wxPyAuiTabArt : public wxAuiDefaultTabArt
{
public:
wxPyAuiTabArt() : wxAuiDefaultTabArt() {}
virtual void DrawBackground( wxDC& dc,
wxWindow* wnd,
const wxRect& rect )
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawBackground"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* ownd = wxPyMake_wxObject(wnd, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, ownd, orect));
Py_DECREF(odc);
Py_DECREF(ownd);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (!found)
wxAuiDefaultTabArt::DrawBackground(dc, wnd, rect);
}
virtual void DrawTab( wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent)
{
wxRect* potr = out_tab_rect;
wxRect* pobr = out_button_rect;
bool found;
const char* errmsg = "DrawTab should return a sequence containing (tab_rect, button_rect, x_extent)";
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawTab"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* ownd = wxPyMake_wxObject(wnd, false);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiNotebookPage"), 0);
PyObject* orect = wxPyConstructObject((void*)&in_rect, wxT("wxRect"), 0);
PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue(
"(OOOOi)",
odc, ownd, opane, orect,
close_button_state));
if (ro) {
if (PySequence_Check(ro) && PyObject_Length(ro) == 3) {
PyObject* o1 = PySequence_GetItem(ro, 0);
PyObject* o2 = PySequence_GetItem(ro, 1);
PyObject* o3 = PySequence_GetItem(ro, 2);
if (!wxRect_helper(o1, &potr))
PyErr_SetString(PyExc_TypeError, errmsg);
else if (!wxRect_helper(o2, &pobr))
PyErr_SetString(PyExc_TypeError, errmsg);
else if (!PyInt_Check(o3))
PyErr_SetString(PyExc_TypeError, errmsg);
else {
*x_extent = PyInt_AsLong(o3);
*out_tab_rect = *potr;
*out_button_rect = *pobr;
}
Py_DECREF(o1);
Py_DECREF(o2);
Py_DECREF(o3);
}
else {
PyErr_SetString(PyExc_TypeError, errmsg);
}
Py_DECREF(ro);
}
Py_DECREF(odc);
Py_DECREF(ownd);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (!found)
wxAuiDefaultTabArt::DrawTab(dc, wnd, pane, in_rect, close_button_state,
out_tab_rect, out_button_rect, x_extent);
}
virtual void DrawButton( wxDC& dc,
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
int orientation,
wxRect* out_rect)
{
wxRect* por = out_rect;
bool found;
const char* errmsg = "DrawButton should return a wxRect";
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawButton"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* ownd = wxPyMake_wxObject(wnd, false);
PyObject* orect = wxPyConstructObject((void*)&in_rect, wxT("wxRect"), 0);
PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOiii)", odc, ownd, orect,
bitmap_id, button_state, orientation));
if (ro) {
if (!wxRect_helper(ro, &por))
PyErr_SetString(PyExc_TypeError, errmsg);
else
*out_rect = *por;
Py_DECREF(ro);
}
Py_DECREF(odc);
Py_DECREF(ownd);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (!found)
wxAuiDefaultTabArt::DrawButton(dc, wnd, in_rect, bitmap_id, button_state, orientation, out_rect);
}
virtual wxSize GetTabSize( wxDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool active,
int close_button_state,
int* x_extent)
{
bool found;
wxSize rv, *prv = &rv;
const char* errmsg = "GetTabSize should return a sequence containing (size, x_extent)";
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "GetTabSize"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* ownd = wxPyMake_wxObject(wnd, false);
PyObject* otext = wx2PyString(caption);
PyObject* obmp = wxPyMake_wxObject((wxObject*)&bitmap, false);
PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst,
Py_BuildValue("(OOOOii)",
odc, ownd, otext, obmp,
(int)active, close_button_state));
if (ro) {
if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
PyObject* o1 = PySequence_GetItem(ro, 0);
PyObject* o2 = PySequence_GetItem(ro, 1);
if (!wxSize_helper(o1, &prv))
PyErr_SetString(PyExc_TypeError, errmsg);
else if (!PyInt_Check(o2))
PyErr_SetString(PyExc_TypeError, errmsg);
else {
*x_extent = PyInt_AsLong(o2);
rv = *prv;
}
Py_DECREF(o1);
Py_DECREF(o2);
}
else {
PyErr_SetString(PyExc_TypeError, errmsg);
}
Py_DECREF(ro);
}
Py_DECREF(odc);
Py_DECREF(ownd);
Py_DECREF(otext);
Py_DECREF(obmp);
}
wxPyEndBlockThreads(blocked);
if (!found)
rv = wxAuiDefaultTabArt::GetTabSize(dc, wnd, caption, bitmap, active,
close_button_state, x_extent);
return rv;
}
virtual wxAuiTabArt* Clone()
{
wxAuiTabArt* rval = NULL;
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "Clone"))) {
PyObject* ro;
ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));
if (ro) {
wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxAuiTabArt"));
// release ownership of the C++ object
PyObject_SetAttrString(ro, "thisown", Py_False);
Py_DECREF(ro);
}
}
wxPyEndBlockThreads(blocked);
if (! found)
rval = wxAuiDefaultTabArt::Clone();
return rval;
}
virtual int GetIndentSize()
{
int rval=0;
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "GetIndentSize")))
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));
wxPyEndBlockThreads(blocked);
if (! found)
rval = wxAuiDefaultTabArt::GetIndentSize();
return rval;
}
virtual void SetSizingInfo(const wxSize& tab_ctrl_size,
size_t tab_count)
{
bool found;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "SetSizingInfo"))) {
PyObject* osize = wxPyConstructObject((void*)&tab_ctrl_size,
wxT("wxSize"), false);
PyObject* ocount = PyInt_FromLong(tab_count);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", osize, ocount));
Py_DECREF(osize);
Py_DECREF(ocount);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxAuiDefaultTabArt::SetSizingInfo(tab_ctrl_size, tab_count);
}
// TODO
// virtual int ShowDropDown(
// wxWindow* wnd,
// const wxAuiNotebookPageArray& items,
// int active_idx);
// virtual int GetBestTabCtrlSize(wxWindow* wnd,
// const wxAuiNotebookPageArray& pages,
// const wxSize& required_bmp_size);
wxFont GetNormalFont() const { return m_normalFont; }
wxFont GetSelectedFont() const { return m_selectedFont; }
wxFont GetMeasuringFont() const { return m_measuringFont; }
int GetFlags() const { return (int)m_flags; }
DEC_PYCALLBACK__FONT(SetNormalFont);
DEC_PYCALLBACK__FONT(SetSelectedFont);
DEC_PYCALLBACK__FONT(SetMeasuringFont);
PYPRIVATE;
};
IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetNormalFont);
IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetSelectedFont);
IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetMeasuringFont);
%}
DocStr(wxPyAuiTabArt,
"This version of the `TabArt` class has been instrumented to be
subclassable in Python and to reflect all calls to the C++ base class
methods to the Python methods implemented in the derived class.", "");
class wxPyAuiTabArt : public wxAuiDefaultTabArt
{
public:
%pythonAppend wxPyAuiTabArt setCallbackInfo(PyAuiTabArt)
wxPyAuiTabArt();
void _setCallbackInfo(PyObject* self, PyObject* _class);
wxFont GetNormalFont() const;
wxFont GetSelectedFont() const;
wxFont GetMeasuringFont() const;
int GetFlags() const;
};
//---------------------------------------------------------------------------
|