Ensure that wxAuiNotebook::SetArtProvider() always does set it.

It used to only set the provider if the height of the tabs defined by the new
provider was different from the one used by the old one, otherwise the call
was optimized away. Fix this by explicitly setting the art provider for all
tabs in SetArtProvider() itself if UpdateTabCtrlHeight() didn't do it.

Closes #9738.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-07-23 23:33:46 +00:00
parent 1632883f9a
commit 4026f044ee
2 changed files with 44 additions and 22 deletions

View File

@@ -590,7 +590,11 @@ protected:
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
// these can be overridden
virtual void UpdateTabCtrlHeight();
// update the height, return true if it was done or false if the new height
// calculated by CalculateTabCtrlHeight() is the same as the old one
virtual bool UpdateTabCtrlHeight();
virtual int CalculateTabCtrlHeight();
virtual wxSize CalculateNewSplitSize();

View File

@@ -2909,7 +2909,23 @@ void wxAuiNotebook::SetArtProvider(wxAuiTabArt* art)
{
m_tabs.SetArtProvider(art);
UpdateTabCtrlHeight();
// Update the height and do nothing else if it did something but otherwise
// (i.e. if the new art provider uses the same height as the old one) we
// need to manually set the art provider for all tabs ourselves.
if ( !UpdateTabCtrlHeight() )
{
wxAuiPaneInfoArray& all_panes = m_mgr.GetAllPanes();
const size_t pane_count = all_panes.GetCount();
for (size_t i = 0; i < pane_count; ++i)
{
wxAuiPaneInfo& pane = all_panes.Item(i);
if (pane.name == wxT("dummy"))
continue;
wxTabFrame* tab_frame = (wxTabFrame*)pane.window;
wxAuiTabCtrl* tabctrl = tab_frame->m_tabs;
tabctrl->SetArtProvider(art->Clone());
}
}
}
// SetTabCtrlHeight() is the highest-level override of the
@@ -2950,16 +2966,17 @@ void wxAuiNotebook::SetUniformBitmapSize(const wxSize& size)
}
// UpdateTabCtrlHeight() does the actual tab resizing. It's meant
// to be used interally
void wxAuiNotebook::UpdateTabCtrlHeight()
// to be used internally
bool wxAuiNotebook::UpdateTabCtrlHeight()
{
// get the tab ctrl height we will use
int height = CalculateTabCtrlHeight();
// if the tab control height needs to change, update
// all of our tab controls with the new height
if (m_tab_ctrl_height != height)
{
if (m_tab_ctrl_height == height)
return false;
wxAuiTabArt* art = m_tabs.GetArtProvider();
m_tab_ctrl_height = height;
@@ -2977,7 +2994,8 @@ void wxAuiNotebook::UpdateTabCtrlHeight()
tabctrl->SetArtProvider(art->Clone());
tab_frame->DoSizing();
}
}
return true;
}
void wxAuiNotebook::UpdateHintWindowSize()