diff --git a/include/wx/aui/auibook.h b/include/wx/aui/auibook.h index 23d66ade71..6f9cb231a2 100644 --- a/include/wx/aui/auibook.h +++ b/include/wx/aui/auibook.h @@ -151,7 +151,7 @@ public: void SetColour(const wxColour& colour); void SetActiveColour(const wxColour& colour); void DoShowHide(); - void SetRect(const wxRect& rect); + void SetRect(const wxRect& rect, wxWindow* wnd = NULL); void RemoveButton(int id); void AddButton(int id, @@ -200,6 +200,8 @@ public: bool IsDragging() const { return m_isDragging; } + void SetRect(const wxRect& rect) { wxAuiTabContainer::SetRect(rect, this); } + protected: // choose the default border for this window virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } diff --git a/include/wx/aui/tabart.h b/include/wx/aui/tabart.h index 565ac1067a..d655ea6738 100644 --- a/include/wx/aui/tabart.h +++ b/include/wx/aui/tabart.h @@ -47,7 +47,8 @@ public: virtual void SetFlags(unsigned int flags) = 0; virtual void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount) = 0; + size_t tabCount, + wxWindow* wnd = NULL) = 0; virtual void SetNormalFont(const wxFont& font) = 0; virtual void SetSelectedFont(const wxFont& font) = 0; @@ -126,7 +127,8 @@ public: wxAuiTabArt* Clone() wxOVERRIDE; void SetFlags(unsigned int flags) wxOVERRIDE; void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount) wxOVERRIDE; + size_t tabCount, + wxWindow* wnd = NULL) wxOVERRIDE; void SetNormalFont(const wxFont& font) wxOVERRIDE; void SetSelectedFont(const wxFont& font) wxOVERRIDE; @@ -228,7 +230,8 @@ public: void SetFlags(unsigned int flags) wxOVERRIDE; void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount) wxOVERRIDE; + size_t tabCount, + wxWindow* wnd = NULL) wxOVERRIDE; void SetNormalFont(const wxFont& font) wxOVERRIDE; void SetSelectedFont(const wxFont& font) wxOVERRIDE; diff --git a/interface/wx/aui/auibook.h b/interface/wx/aui/auibook.h index 47b0f685a8..bafebfba00 100644 --- a/interface/wx/aui/auibook.h +++ b/interface/wx/aui/auibook.h @@ -534,7 +534,7 @@ public: void SetColour(const wxColour& colour); void SetActiveColour(const wxColour& colour); void DoShowHide(); - void SetRect(const wxRect& rect); + void SetRect(const wxRect& rect, wxWindow* wnd = NULL); void RemoveButton(int id); void AddButton(int id, @@ -672,8 +672,13 @@ public: /** Sets sizing information. + + The @a wnd argument is only present in wxWidgets 3.1.6 and newer and is + required, it only has @NULL default value for compatibility reasons. */ - virtual void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) = 0; + virtual void SetSizingInfo(const wxSize& tab_ctrl_size, + size_t tab_count, + wxWindow* wnd = NULL) = 0; }; /** @@ -767,7 +772,8 @@ public: wxAuiTabArt* Clone(); void SetFlags(unsigned int flags); void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount); + size_t tabCount, + wxWindow* wnd = NULL); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); @@ -872,7 +878,8 @@ public: void SetFlags(unsigned int flags); void SetSizingInfo(const wxSize& tabCtrlSize, - size_t tabCount); + size_t tabCount, + wxWindow* wnd = NULL); void SetNormalFont(const wxFont& font); void SetSelectedFont(const wxFont& font); diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index f22589e2a2..ce4d654200 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -168,13 +168,13 @@ void wxAuiTabContainer::SetActiveColour(const wxColour& colour) m_art->SetActiveColour(colour); } -void wxAuiTabContainer::SetRect(const wxRect& rect) +void wxAuiTabContainer::SetRect(const wxRect& rect, wxWindow* wnd) { m_rect = rect; if (m_art) { - m_art->SetSizingInfo(rect.GetSize(), m_pages.GetCount()); + m_art->SetSizingInfo(rect.GetSize(), m_pages.GetCount(), wnd); } } @@ -191,7 +191,7 @@ bool wxAuiTabContainer::AddPage(wxWindow* page, // let the art provider know how many pages we have if (m_art) { - m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount()); + m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount(), page); } return true; @@ -214,7 +214,7 @@ bool wxAuiTabContainer::InsertPage(wxWindow* page, // let the art provider know how many pages we have if (m_art) { - m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount()); + m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount(), page); } return true; @@ -252,7 +252,7 @@ bool wxAuiTabContainer::RemovePage(wxWindow* wnd) // let the art provider know how many pages we have if (m_art) { - m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount()); + m_art->SetSizingInfo(m_rect.GetSize(), m_pages.GetCount(), wnd); } return true; diff --git a/src/aui/tabart.cpp b/src/aui/tabart.cpp index bf926fcf5a..44d2175753 100644 --- a/src/aui/tabart.cpp +++ b/src/aui/tabart.cpp @@ -18,6 +18,7 @@ #if wxUSE_AUI #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/dc.h" #include "wx/dcclient.h" #include "wx/settings.h" @@ -232,9 +233,18 @@ void wxAuiGenericTabArt::SetFlags(unsigned int flags) } void wxAuiGenericTabArt::SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count) + size_t tab_count, + wxWindow* wnd) { - m_fixedTabWidth = wxWindow::FromDIP(100, NULL); + if ( !wnd ) + { + // This is only allowed for backwards compatibility, we should be + // really passed a valid window. + wnd = wxTheApp->GetTopWindow(); + wxCHECK_RET( wnd, "must have some window" ); + } + + m_fixedTabWidth = wnd->FromDIP(100); int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - wxWindow::FromDIP(4, NULL); @@ -948,9 +958,16 @@ void wxAuiSimpleTabArt::SetFlags(unsigned int flags) } void wxAuiSimpleTabArt::SetSizingInfo(const wxSize& tab_ctrl_size, - size_t tab_count) + size_t tab_count, + wxWindow* wnd) { - m_fixedTabWidth = wxWindow::FromDIP(100, NULL); + if ( !wnd ) + { + wnd = wxTheApp->GetTopWindow(); + wxCHECK_RET( wnd, "must have some window" ); + } + + m_fixedTabWidth = wnd->FromDIP(100); int tot_width = (int)tab_ctrl_size.x - GetIndentSize() - wxWindow::FromDIP(4, NULL);