]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/aui.i
Updating with Vadim's API changes.
[wxWidgets.git] / wxPython / src / aui.i
CommitLineData
febb39df
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: aui.i
3// Purpose: Wrappers for the wxAUI classes.
4//
5// Author: Robin Dunn
6//
7// Created: 5-July-2006
8// RCS-ID: $Id$
9// Copyright: (c) 2006 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13%define DOCSTRING
14"The wx.aui moduleis an Advanced User Interface library that aims to
15implement \"cutting-edge\" interface usability and design features so
16developers can quickly and easily create beautiful and usable
17application interfaces.
18
19**Vision and Design Principles**
20
21wx.aui attempts to encapsulate the following aspects of the user
22interface:
23
24 * Frame Management: Frame management provides the means to open,
25 move and hide common controls that are needed to interact with the
26 document, and allow these configurations to be saved into
27 different perspectives and loaded at a later time.
28
29 * Toolbars: Toolbars are a specialized subset of the frame
30 management system and should behave similarly to other docked
31 components. However, they also require additional functionality,
32 such as \"spring-loaded\" rebar support, \"chevron\" buttons and
33 end-user customizability.
34
35 * Modeless Controls: Modeless controls expose a tool palette or set
36 of options that float above the application content while allowing
37 it to be accessed. Usually accessed by the toolbar, these controls
38 disappear when an option is selected, but may also be \"torn off\"
39 the toolbar into a floating frame of their own.
40
41 * Look and Feel: Look and feel encompasses the way controls are
42 drawn, both when shown statically as well as when they are being
43 moved. This aspect of user interface design incorporates \"special
44 effects\" such as transparent window dragging as well as frame
45 animation.
46
2a783b2d 47**wx.aui adheres to the following principles**
febb39df
RD
48
49 - Use native floating frames to obtain a native look and feel for
50 all platforms;
51
52 - Use existing wxPython code where possible, such as sizer
53 implementation for frame management;
54
55 - Use standard wxPython coding conventions.
56
57
58**Usage**
59
60The following example shows a simple implementation that utilizes
61`wx.aui.FrameManager` to manage three text controls in a frame window::
62
63 import wx
64 import wx.aui
65
66 class MyFrame(wx.Frame):
67
68 def __init__(self, parent, id=-1, title='wx.aui Test',
69 size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):
70 wx.Frame.__init__(self, parent, id, title, pos, size, style)
71
2a783b2d 72 self._mgr = wx.aui.AuiManager(self)
febb39df
RD
73
74 # create several text controls
75 text1 = wx.TextCtrl(self, -1, 'Pane 1 - sample text',
76 wx.DefaultPosition, wx.Size(200,150),
77 wx.NO_BORDER | wx.TE_MULTILINE)
78
79 text2 = wx.TextCtrl(self, -1, 'Pane 2 - sample text',
80 wx.DefaultPosition, wx.Size(200,150),
81 wx.NO_BORDER | wx.TE_MULTILINE)
82
83 text3 = wx.TextCtrl(self, -1, 'Main content window',
84 wx.DefaultPosition, wx.Size(200,150),
85 wx.NO_BORDER | wx.TE_MULTILINE)
86
87 # add the panes to the manager
88 self._mgr.AddPane(text1, wx.LEFT, 'Pane Number One')
89 self._mgr.AddPane(text2, wx.BOTTOM, 'Pane Number Two')
90 self._mgr.AddPane(text3, wx.CENTER)
91
92 # tell the manager to 'commit' all the changes just made
93 self._mgr.Update()
94
95 self.Bind(wx.EVT_CLOSE, self.OnClose)
96
97
98 def OnClose(self, event):
99 # deinitialize the frame manager
100 self._mgr.UnInit()
101 # delete the frame
102 self.Destroy()
103
104
105 app = wx.App()
106 frame = MyFrame(None)
107 frame.Show()
108 app.MainLoop()
109"
110%enddef
111
112
113
114%module(package="wx", docstring=DOCSTRING) aui
115
116%{
117#include "wx/wxPython/wxPython.h"
118#include "wx/wxPython/pyclasses.h"
119#include <wx/aui/aui.h>
120%}
121
122//---------------------------------------------------------------------------
123
124%import core.i
125%import windows.i
126
127%pythoncode { wx = _core }
128%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
129
130
131%include _aui_docstrings.i
132
133//---------------------------------------------------------------------------
134
135
136#define wxUSE_AUI 1
137#define WXDLLIMPEXP_AUI
138#define unsigned
d7a7616b
RD
139#define wxDEPRECATED(decl)
140
febb39df 141
1c976bff
RD
142// We'll skip making wrappers for these, they have overloads that take a
143// wxSize or wxPoint
2a783b2d
RD
144%ignore wxAuiPaneInfo::MaxSize(int x, int y);
145%ignore wxAuiPaneInfo::MinSize(int x, int y);
146%ignore wxAuiPaneInfo::BestSize(int x, int y);
147%ignore wxAuiPaneInfo::FloatingPosition(int x, int y);
148%ignore wxAuiPaneInfo::FloatingSize(int x, int y);
febb39df
RD
149
150// But for these we will do the overloading (see %pythoncode below) so let's
151// rename the C++ versions
2a783b2d
RD
152%rename(_GetPaneByWidget) wxAuiManager::GetPane(wxWindow* window);
153%rename(_GetPaneByName) wxAuiManager::GetPane(const wxString& name);
febb39df 154
2a783b2d
RD
155%rename(_AddPane1) wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
156%rename(_AddPane2) wxAuiManager::AddPane(wxWindow* window, int direction = wxLEFT,
157 const wxString& caption = wxEmptyString);
febb39df 158
2a783b2d
RD
159%rename(AddPaneAtPos) wxAuiManager::AddPane(wxWindow* window,
160 const wxPaneInfo& pane_info,
161 const wxPoint& drop_pos);
febb39df
RD
162
163// A typemap for the return value of wxFrameManager::GetAllPanes
2a783b2d 164%typemap(out) wxAuiPaneInfoArray& {
febb39df
RD
165 $result = PyList_New(0);
166 for (size_t i=0; i < $1->GetCount(); i++) {
2a783b2d 167 PyObject* pane_obj = SWIG_NewPointerObj((void*)(&$1->Item(i)), SWIGTYPE_p_wxAuiPaneInfo, 0);
febb39df
RD
168 PyList_Append($result, pane_obj);
169 }
170}
171
172
1c976bff
RD
173%nokwargs wxAuiTabContainer::SetActivePage;
174
175%pythonAppend wxAuiTabCtrl::wxAuiTabCtrl "self._setOORInfo(self)";
176
2a783b2d
RD
177%pythonAppend wxAuiNotebook::wxAuiNotebook "self._setOORInfo(self)";
178%pythonAppend wxAuiNotebook::wxAuiNotebook() "self._setOORInfo(self)";
179%ignore wxAuiiNotebook::~wxAuiNotebook;
180%rename(PreAuiNotebook) wxAuiNotebook::wxAuiNotebook();
1c976bff 181
54af9b8b
RD
182
183
184%ignore wxAuiDefaultTabArt::SetWindow; // Link error...
185
d48ae46b
RD
186// ignore this overload
187%ignore wxAuiTabContainer::GetPage(size_t idx) const;
188
189
febb39df
RD
190//---------------------------------------------------------------------------
191// Get all our defs from the REAL header files.
192%include framemanager.h
193%include dockart.h
194%include floatpane.h
1c976bff 195%include auibook.h
febb39df
RD
196
197//---------------------------------------------------------------------------
198// Methods to inject into the FrameManager class that will sort out calls to
199// the overloaded versions of GetPane and AddPane
200
2a783b2d 201%extend wxAuiManager {
d7a7616b 202 %pythoncode {
febb39df
RD
203 def GetPane(self, item):
204 """
205 GetPane(self, window_or_info item) -> PaneInfo
206
207 GetPane is used to search for a `PaneInfo` object either by
208 widget reference or by pane name, which acts as a unique id
209 for a window pane. The returned `PaneInfo` object may then be
210 modified to change a pane's look, state or position. After one
211 or more modifications to the `PaneInfo`, `FrameManager.Update`
212 should be called to realize the changes to the user interface.
213
214 If the lookup failed (meaning the pane could not be found in
215 the manager) GetPane returns an empty `PaneInfo`, a condition
216 which can be checked by calling `PaneInfo.IsOk`.
217 """
218 if isinstance(item, wx.Window):
219 return self._GetPaneByWidget(item)
220 else:
221 return self._GetPaneByName(item)
222
223 def AddPane(self, window, info=None, caption=None):
224 """
225 AddPane(self, window, info=None, caption=None) -> bool
226
227 AddPane tells the frame manager to start managing a child
228 window. There are two versions of this function. The first
229 verison accepts a `PaneInfo` object for the ``info`` parameter
230 and allows the full spectrum of pane parameter
231 possibilities. (Say that 3 times fast!)
232
233 The second version is used for simpler user interfaces which
234 do not require as much configuration. In this case the
235 ``info`` parameter specifies the direction property of the
236 pane info, and defaults to ``wx.LEFT``. The pane caption may
237 also be specified as an extra parameter in this form.
238 """
2a783b2d 239 if type(info) == AuiPaneInfo:
4c16bedf 240 return self._AddPane1(window, info)
febb39df
RD
241 else:
242 # This Is AddPane2
4c16bedf
RD
243 if info is None:
244 info = wx.LEFT
245 if caption is None:
246 caption = ""
247 return self._AddPane2(window, info, caption)
d7a7616b
RD
248 }
249
250 // For backwards compatibility
251 %pythoncode {
252 SetFrame = wx._deprecated(SetManagedWindow,
253 "SetFrame is deprecated, use `SetManagedWindow` instead.")
254 GetFrame = wx._deprecated(GetManagedWindow,
255 "GetFrame is deprecated, use `GetManagedWindow` instead.")
256 }
febb39df
RD
257}
258
2a783b2d
RD
259%extend wxAuiDockInfo {
260 ~wxAuiDockInfo() {}
050441c8
RD
261}
262
2a783b2d
RD
263%extend wxAuiDockUIPart {
264 ~wxAuiDockUIPart() {}
050441c8
RD
265}
266
2a783b2d
RD
267%extend wxAuiPaneButton {
268 ~wxAuiPaneButton() {}
050441c8
RD
269}
270
febb39df
RD
271//---------------------------------------------------------------------------
272
273%{
2db4b82e 274// A wxDocArt class that knows how to forward virtuals to Python methods
2a783b2d 275class wxPyAuiDockArt : public wxAuiDefaultDockArt
febb39df 276{
2a783b2d 277 wxPyAuiDockArt() : wxAuiDefaultDockArt() {}
febb39df
RD
278
279 DEC_PYCALLBACK_INT_INT(GetMetric);
280 DEC_PYCALLBACK_VOID_INTINT(SetMetric);
281 DEC_PYCALLBACK__INTFONT(SetFont);
282 DEC_PYCALLBACK_FONT_INT(GetFont);
283 DEC_PYCALLBACK_COLOUR_INT(GetColour);
284 DEC_PYCALLBACK__INTCOLOUR(SetColour);
285
286 virtual void DrawSash(wxDC& dc,
e81b607b 287 wxWindow* window,
febb39df
RD
288 int orientation,
289 const wxRect& rect)
290 {
291 bool found;
292 wxPyBlock_t blocked = wxPyBeginBlockThreads();
293 if ((found = wxPyCBH_findCallback(m_myInst, "DrawSash"))) {
294 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 295 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df 296 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
e81b607b
RD
297 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
298 odc, owin, orientation, orect));
febb39df 299 Py_DECREF(odc);
8f514ab4 300 Py_DECREF(owin);
febb39df
RD
301 Py_DECREF(orect);
302 }
303 wxPyEndBlockThreads(blocked);
304 if (! found)
2a783b2d 305 wxAuiDefaultDockArt::DrawSash(dc, window, orientation, rect);
febb39df
RD
306 }
307
308 virtual void DrawBackground(wxDC& dc,
e81b607b 309 wxWindow* window,
febb39df
RD
310 int orientation,
311 const wxRect& rect)
312 {
313 bool found;
314 wxPyBlock_t blocked = wxPyBeginBlockThreads();
315 if ((found = wxPyCBH_findCallback(m_myInst, "DrawBackground"))) {
316 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 317 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df 318 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
e81b607b
RD
319 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
320 odc, owin, orientation, orect));
febb39df 321 Py_DECREF(odc);
8f514ab4 322 Py_DECREF(owin);
febb39df
RD
323 Py_DECREF(orect);
324 }
325 wxPyEndBlockThreads(blocked);
326 if (! found)
2a783b2d 327 wxAuiDefaultDockArt::DrawBackground(dc, window, orientation, rect);
febb39df
RD
328 }
329
330 virtual void DrawCaption(wxDC& dc,
e81b607b 331 wxWindow* window,
febb39df
RD
332 const wxString& text,
333 const wxRect& rect,
2a783b2d 334 wxAuiPaneInfo& pane)
febb39df
RD
335 {
336 bool found;
337 wxPyBlock_t blocked = wxPyBeginBlockThreads();
338 if ((found = wxPyCBH_findCallback(m_myInst, "DrawCaption"))) {
339 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 340 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df
RD
341 PyObject* otext = wx2PyString(text);
342 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
2a783b2d 343 PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
e81b607b
RD
344 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOO)",
345 odc, owin, otext, orect, opane));
febb39df 346 Py_DECREF(odc);
8f514ab4 347 Py_DECREF(owin);
febb39df
RD
348 Py_DECREF(otext);
349 Py_DECREF(orect);
350 Py_DECREF(opane);
351 }
352 wxPyEndBlockThreads(blocked);
353 if (! found)
2a783b2d 354 wxAuiDefaultDockArt::DrawCaption(dc, window, text, rect, pane);
febb39df
RD
355 }
356
357 virtual void DrawGripper(wxDC& dc,
e81b607b 358 wxWindow* window,
febb39df 359 const wxRect& rect,
2a783b2d 360 wxAuiPaneInfo& pane)
febb39df
RD
361 {
362 bool found;
363 wxPyBlock_t blocked = wxPyBeginBlockThreads();
364 if ((found = wxPyCBH_findCallback(m_myInst, "DrawGripper"))) {
365 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 366 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df 367 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
2a783b2d 368 PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
e81b607b 369 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOO)", odc, owin, orect, opane));
febb39df
RD
370 Py_DECREF(odc);
371 Py_DECREF(orect);
372 Py_DECREF(opane);
373 }
374 wxPyEndBlockThreads(blocked);
375 if (! found)
2a783b2d 376 wxAuiDefaultDockArt::DrawGripper(dc, window, rect, pane);
febb39df
RD
377 }
378
379 virtual void DrawBorder(wxDC& dc,
e81b607b 380 wxWindow* window,
febb39df 381 const wxRect& rect,
2a783b2d 382 wxAuiPaneInfo& pane)
febb39df
RD
383 {
384 bool found;
385 wxPyBlock_t blocked = wxPyBeginBlockThreads();
386 if ((found = wxPyCBH_findCallback(m_myInst, "DrawBorder"))) {
387 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 388 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df 389 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
2a783b2d 390 PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
febb39df
RD
391 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, orect, opane));
392 Py_DECREF(odc);
8f514ab4 393 Py_DECREF(owin);
febb39df
RD
394 Py_DECREF(orect);
395 Py_DECREF(opane);
396 }
397 wxPyEndBlockThreads(blocked);
398 if (! found)
2a783b2d 399 wxAuiDefaultDockArt::DrawBorder(dc, window, rect, pane);
febb39df
RD
400 }
401
402 virtual void DrawPaneButton(wxDC& dc,
e81b607b 403 wxWindow* window,
febb39df
RD
404 int button,
405 int button_state,
406 const wxRect& rect,
2a783b2d 407 wxAuiPaneInfo& pane)
febb39df
RD
408 {
409 bool found;
410 wxPyBlock_t blocked = wxPyBeginBlockThreads();
411 if ((found = wxPyCBH_findCallback(m_myInst, "DrawPaneButton"))) {
412 PyObject* odc = wxPyMake_wxObject(&dc, false);
e81b607b 413 PyObject* owin = wxPyMake_wxObject(window, false);
febb39df 414 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
2a783b2d 415 PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiPaneInfo"), 0);
e81b607b
RD
416 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiIOO)",
417 odc, owin, button, button_state,
febb39df
RD
418 orect, opane));
419 Py_DECREF(odc);
8f514ab4 420 Py_DECREF(owin);
febb39df
RD
421 Py_DECREF(orect);
422 Py_DECREF(opane);
423 }
424 wxPyEndBlockThreads(blocked);
425 if (! found)
2a783b2d 426 wxAuiDefaultDockArt::DrawPaneButton(dc, window, button, button_state, rect, pane);
febb39df
RD
427 }
428
429 PYPRIVATE;
430
431};
432
2a783b2d
RD
433IMP_PYCALLBACK_INT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetMetric);
434IMP_PYCALLBACK_VOID_INTINT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetMetric);
435IMP_PYCALLBACK__INTFONT(wxPyAuiDockArt, wxAuiDefaultDockArt, SetFont);
436IMP_PYCALLBACK_FONT_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetFont);
437IMP_PYCALLBACK_COLOUR_INT(wxPyAuiDockArt, wxAuiDefaultDockArt, GetColour);
438IMP_PYCALLBACK__INTCOLOUR(wxPyAuiDockArt, wxAuiDefaultDockArt, SetColour);
febb39df
RD
439
440%}
441
442
2a783b2d
RD
443DocStr(wxPyAuiDockArt,
444"This version of the `AuiDockArt` class has been instrumented to be
febb39df
RD
445subclassable in Python and to reflect all calls to the C++ base class
446methods to the Python methods implemented in the derived class.", "");
447
2a783b2d 448class wxPyAuiDockArt : public wxAuiDefaultDockArt
febb39df 449{
c25f90f6 450 %pythonAppend wxPyAuiDockArt setCallbackInfo(PyAuiDockArt)
2a783b2d 451 wxPyAuiDocArt();
febb39df
RD
452
453};
454
455
777e547f
RD
456//---------------------------------------------------------------------------
457
2a783b2d 458%extend wxAuiNotebook {
777e547f
RD
459 %property(PageCount, GetPageCount, doc="See `GetPageCount`");
460 %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`");
461}
462
463
464%extend wxAuiNotebookEvent {
465 %property(OldSelection, GetOldSelection, SetOldSelection, doc="See `GetOldSelection` and `SetOldSelection`");
466 %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`");
467}
468
469
470%extend wxAuiTabContainer {
471 %property(ActivePage, GetActivePage, SetActivePage, doc="See `GetActivePage` and `SetActivePage`");
472 %property(PageCount, GetPageCount, doc="See `GetPageCount`");
473 %property(Pages, GetPages, doc="See `GetPages`");
474}
475
476
2a783b2d 477%extend wxAuiManager {
777e547f
RD
478 %property(AllPanes, GetAllPanes, doc="See `GetAllPanes`");
479 %property(ArtProvider, GetArtProvider, SetArtProvider, doc="See `GetArtProvider` and `SetArtProvider`");
480 %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`");
481 %property(ManagedWindow, GetManagedWindow, SetManagedWindow, doc="See `GetManagedWindow` and `SetManagedWindow`");
482}
483
484
2a783b2d 485%extend wxAuiManagerEvent {
777e547f
RD
486 %property(Button, GetButton, SetButton, doc="See `GetButton` and `SetButton`");
487 %property(DC, GetDC, SetDC, doc="See `GetDC` and `SetDC`");
488 %property(Pane, GetPane, SetPane, doc="See `GetPane` and `SetPane`");
489}
490
491
2db4b82e
RD
492//---------------------------------------------------------------------------
493
494%{
495// A wxTabArt class that knows how to forward virtuals to Python methods
2a783b2d 496class wxPyAuiTabArt : public wxAuiDefaultTabArt
2db4b82e 497{
2a783b2d 498 wxPyAuiTabArt() : wxAuiDefaultTabArt() {}
2db4b82e 499
8f514ab4 500
d95b9f2b 501 virtual void DrawBackground( wxDC& dc,
54af9b8b 502 wxWindow* wnd,
2db4b82e
RD
503 const wxRect& rect )
504 {
505 bool found;
506 wxPyBlock_t blocked = wxPyBeginBlockThreads();
507 if ((found = wxPyCBH_findCallback(m_myInst, "DrawBackground"))) {
d95b9f2b 508 PyObject* odc = wxPyMake_wxObject(&dc, false);
54af9b8b 509 PyObject* ownd = wxPyMake_wxObject(wnd, false);
2db4b82e 510 PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
54af9b8b 511 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, ownd, orect));
2db4b82e 512 Py_DECREF(odc);
54af9b8b 513 Py_DECREF(ownd);
2db4b82e
RD
514 Py_DECREF(orect);
515 }
516 wxPyEndBlockThreads(blocked);
517 if (!found)
54af9b8b 518 wxAuiDefaultTabArt::DrawBackground(dc, wnd, rect);
2db4b82e
RD
519 }
520
d95b9f2b 521 virtual void DrawTab( wxDC& dc,
54af9b8b 522 wxWindow* wnd,
81fd0478 523 const wxAuiNotebookPage& pane,
2db4b82e 524 const wxRect& in_rect,
36cb9ebe
RD
525 int close_button_state,
526 wxRect* out_tab_rect,
527 wxRect* out_button_rect,
2db4b82e
RD
528 int* x_extent)
529 {
530 bool found;
36cb9ebe 531 const char* errmsg = "DrawTab should return a sequence containing (tab_rect, button_rect, x_extent)";
2db4b82e
RD
532 wxPyBlock_t blocked = wxPyBeginBlockThreads();
533 if ((found = wxPyCBH_findCallback(m_myInst, "DrawTab"))) {
d95b9f2b 534 PyObject* odc = wxPyMake_wxObject(&dc, false);
54af9b8b 535 PyObject* ownd = wxPyMake_wxObject(wnd, false);
81fd0478 536 PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxAuiNotebookPage"), 0);
2db4b82e 537 PyObject* orect = wxPyConstructObject((void*)&in_rect, wxT("wxRect"), 0);
2db4b82e 538 PyObject* ro;
2a783b2d 539 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue(
bce16979 540 "(OOOOOii)",
81fd0478
KO
541 odc, ownd, orect, opane,
542 close_button_state));
2db4b82e 543 if (ro) {
36cb9ebe 544 if (PySequence_Check(ro) && PyObject_Length(ro) == 3) {
2db4b82e
RD
545 PyObject* o1 = PySequence_GetItem(ro, 0);
546 PyObject* o2 = PySequence_GetItem(ro, 1);
36cb9ebe
RD
547 PyObject* o3 = PySequence_GetItem(ro, 2);
548 if (!wxRect_helper(o1, &out_tab_rect))
2db4b82e 549 PyErr_SetString(PyExc_TypeError, errmsg);
36cb9ebe
RD
550 else if (!wxRect_helper(o2, &out_button_rect))
551 PyErr_SetString(PyExc_TypeError, errmsg);
552 else if (!PyInt_Check(o3))
2db4b82e
RD
553 PyErr_SetString(PyExc_TypeError, errmsg);
554 else
36cb9ebe 555 *x_extent = PyInt_AsLong(o3);
2db4b82e
RD
556
557 Py_DECREF(o1);
558 Py_DECREF(o2);
36cb9ebe 559 Py_DECREF(o3);
2db4b82e
RD
560 }
561 else {
562 PyErr_SetString(PyExc_TypeError, errmsg);
563 }
564 Py_DECREF(ro);
565 }
566
567 Py_DECREF(odc);
54af9b8b 568 Py_DECREF(ownd);
2db4b82e 569 Py_DECREF(orect);
81fd0478 570 Py_DECREF(opane);
2db4b82e
RD
571 }
572 wxPyEndBlockThreads(blocked);
573 if (!found)
81fd0478 574 wxAuiDefaultTabArt::DrawTab(dc, wnd, pane, in_rect, close_button_state, out_tab_rect, out_button_rect, x_extent);
2db4b82e
RD
575 }
576
577
d95b9f2b 578 virtual void DrawButton( wxDC& dc,
54af9b8b 579 wxWindow* wnd,
8f514ab4
RD
580 const wxRect& in_rect,
581 int bitmap_id,
582 int button_state,
583 int orientation,
8f514ab4
RD
584 wxRect* out_rect)
585 {
586 bool found;
587 const char* errmsg = "DrawButton should return a wxRect";
588 wxPyBlock_t blocked = wxPyBeginBlockThreads();
589 if ((found = wxPyCBH_findCallback(m_myInst, "DrawButton"))) {
d95b9f2b 590 PyObject* odc = wxPyMake_wxObject(&dc, false);
54af9b8b 591 PyObject* ownd = wxPyMake_wxObject(wnd, false);
8f514ab4 592 PyObject* orect = wxPyConstructObject((void*)&in_rect, wxT("wxRect"), 0);
8f514ab4 593 PyObject* ro;
54af9b8b 594 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OOOiiiO)", odc, ownd, orect,
81fd0478 595 bitmap_id, button_state, orientation));
8f514ab4
RD
596 if (ro) {
597 if (!wxRect_helper(ro, &out_rect))
598 PyErr_SetString(PyExc_TypeError, errmsg);
599 Py_DECREF(ro);
600 }
601
602 Py_DECREF(odc);
54af9b8b 603 Py_DECREF(ownd);
8f514ab4 604 Py_DECREF(orect);
8f514ab4
RD
605 }
606 wxPyEndBlockThreads(blocked);
607 if (!found)
81fd0478 608 wxAuiDefaultTabArt::DrawButton(dc, wnd, in_rect, bitmap_id, button_state, orientation, out_rect);
8f514ab4
RD
609 }
610
54af9b8b 611
d95b9f2b 612 virtual wxSize GetTabSize( wxDC& dc,
54af9b8b 613 wxWindow* wnd,
8f514ab4 614 const wxString& caption,
bce16979 615 const wxBitmap& bitmap,
8f514ab4 616 bool active,
36cb9ebe 617 int close_button_state,
8f514ab4
RD
618 int* x_extent)
619 {
620 bool found;
621 wxSize rv, *prv = &rv;
622 const char* errmsg = "GetTabSize should return a sequence containing (size, x_extent)";
623 wxPyBlock_t blocked = wxPyBeginBlockThreads();
624 if ((found = wxPyCBH_findCallback(m_myInst, "GetTabSize"))) {
d95b9f2b 625 PyObject* odc = wxPyMake_wxObject(&dc, false);
54af9b8b 626 PyObject* ownd = wxPyMake_wxObject(wnd, false);
8f514ab4 627 PyObject* otext = wx2PyString(caption);
bce16979 628 PyObject* obmp = wxPyMake_wxObject((wxObject*)&bitmap, false);
8f514ab4 629 PyObject* ro;
2a783b2d 630 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue(
bce16979 631 "(OOOOii)", odc, ownd, otext, obmp, (int)active, close_button_state));
8f514ab4
RD
632 if (ro) {
633 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {
634 PyObject* o1 = PySequence_GetItem(ro, 0);
635 PyObject* o2 = PySequence_GetItem(ro, 1);
636 if (!wxSize_helper(o1, &prv))
637 PyErr_SetString(PyExc_TypeError, errmsg);
638 else if (!PyInt_Check(o2))
639 PyErr_SetString(PyExc_TypeError, errmsg);
640 else
641 *x_extent = PyInt_AsLong(o2);
642
643 Py_DECREF(o1);
644 Py_DECREF(o2);
645 }
646 else {
647 PyErr_SetString(PyExc_TypeError, errmsg);
648 }
649 Py_DECREF(ro);
650 }
651
652 Py_DECREF(odc);
54af9b8b 653 Py_DECREF(ownd);
8f514ab4 654 Py_DECREF(otext);
bce16979 655 Py_DECREF(obmp);
8f514ab4
RD
656 }
657 wxPyEndBlockThreads(blocked);
658 if (!found)
bce16979 659 rv = wxAuiDefaultTabArt::GetTabSize(dc, wnd, caption, bitmap, active, close_button_state, x_extent);
8f514ab4
RD
660 return rv;
661 }
54af9b8b 662
d95b9f2b 663// TODO
81fd0478 664// virtual int ShowDropDown(
d95b9f2b 665// wxWindow* wnd,
81fd0478 666// const wxAuiNotebookPageArray& items,
d95b9f2b 667// int active_idx);
81fd0478
KO
668
669// virtual int GetIndentSize();
670
bce16979 671// virtual int GetBestTabCtrlSize(wxWindow* wnd,
81fd0478
KO
672// const wxAuiNotebookPageArray& pages,
673// const wxSize& required_bmp_size);
bce16979
RD
674// virtual wxAuiTabArt* Clone();
675// virtual void SetFlags(unsigned int flags);
676// virtual void SetSizingInfo(const wxSize& tab_ctrl_size,
677// size_t tab_count);
678// virtual int GetIndentSize();
679
d95b9f2b 680
8f514ab4 681
2db4b82e
RD
682 DEC_PYCALLBACK__FONT(SetNormalFont);
683 DEC_PYCALLBACK__FONT(SetSelectedFont);
684 DEC_PYCALLBACK__FONT(SetMeasuringFont);
bce16979 685// DEC_PYCALLBACK_INT_WIN(GetBestTabCtrlSize);
2db4b82e
RD
686
687 PYPRIVATE;
688};
689
690
2a783b2d
RD
691IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetNormalFont);
692IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetSelectedFont);
693IMP_PYCALLBACK__FONT(wxPyAuiTabArt, wxAuiDefaultTabArt, SetMeasuringFont);
bce16979 694//IMP_PYCALLBACK_INT_WIN(wxPyAuiTabArt, wxAuiDefaultTabArt, GetBestTabCtrlSize);
2db4b82e
RD
695%}
696
697
2a783b2d 698DocStr(wxPyAuiTabArt,
2db4b82e
RD
699"This version of the `TabArt` class has been instrumented to be
700subclassable in Python and to reflect all calls to the C++ base class
701methods to the Python methods implemented in the derived class.", "");
702
2a783b2d 703class wxPyAuiTabArt : public wxAuiDefaultTabArt
2db4b82e 704{
c25f90f6 705 %pythonAppend wxPyAuiTabArt setCallbackInfo(PyAuiTabArt)
2a783b2d 706 wxPyAuiTabArt();
2db4b82e
RD
707
708};
709
710
777e547f 711//---------------------------------------------------------------------------
febb39df
RD
712
713#undef wxUSE_AUI
714#undef WXDLLIMPEXP_AUI
715
716//---------------------------------------------------------------------------
717