another ghost button bug fixed in wxAuiNotebook

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Benjamin Williams
2006-11-08 16:47:09 +00:00
parent fd4344d64d
commit 4abf84fb01

View File

@@ -1651,6 +1651,9 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
offset += m_art->GetIndentSize(); offset += m_art->GetIndentSize();
// prepare the tab-close-button array // prepare the tab-close-button array
while (m_tab_close_buttons.GetCount() > page_count)
m_tab_close_buttons.RemoveAt(m_tab_close_buttons.GetCount()-1);
while (m_tab_close_buttons.GetCount() < page_count) while (m_tab_close_buttons.GetCount() < page_count)
{ {
wxAuiTabContainerButton tempbtn; wxAuiTabContainerButton tempbtn;
@@ -1660,9 +1663,10 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
m_tab_close_buttons.Add(tempbtn); m_tab_close_buttons.Add(tempbtn);
} }
// buttons before the tab offset must be set to hidden
for (i = 0; i < m_tab_offset; ++i) for (i = 0; i < m_tab_offset; ++i)
{ {
// buttons before the tab offset must be set to hidden
m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN; m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN;
} }
@@ -1707,9 +1711,6 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
if (rect.width <= 0) if (rect.width <= 0)
break; break;
m_art->DrawTab(dc, m_art->DrawTab(dc,
wnd, wnd,
rect, rect,
@@ -1731,6 +1732,14 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
offset += x_extent; offset += x_extent;
} }
// make sure to deactivate buttons which are off the screen to the right
for (++i; i < m_tab_close_buttons.GetCount(); ++i)
{
m_tab_close_buttons.Item(i).cur_state = wxAUI_BUTTON_STATE_HIDDEN;
}
// draw the active tab again so it stands in the foreground // draw the active tab again so it stands in the foreground
if (active >= m_tab_offset && active < m_pages.GetCount()) if (active >= m_tab_offset && active < m_pages.GetCount())
{ {