From: Benjamin Williams Date: Wed, 8 Nov 2006 16:47:09 +0000 (+0000) Subject: another ghost button bug fixed in wxAuiNotebook X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4abf84fb01f883e16adf620877a81053e19ffb79?ds=inline another ghost button bug fixed in wxAuiNotebook git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index bc62aaef78..faf1c52a02 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -1651,6 +1651,9 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) offset += m_art->GetIndentSize(); // 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) { wxAuiTabContainerButton tempbtn; @@ -1660,9 +1663,10 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) m_tab_close_buttons.Add(tempbtn); } + + // buttons before the tab offset must be set to hidden 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; } @@ -1707,9 +1711,6 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) if (rect.width <= 0) break; - - - m_art->DrawTab(dc, wnd, rect, @@ -1731,6 +1732,14 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd) 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 if (active >= m_tab_offset && active < m_pages.GetCount()) {