]> git.saurik.com Git - wxWidgets.git/commitdiff
another ghost button bug fixed in wxAuiNotebook
authorBenjamin Williams <bwilliams@kirix.com>
Wed, 8 Nov 2006 16:47:09 +0000 (16:47 +0000)
committerBenjamin Williams <bwilliams@kirix.com>
Wed, 8 Nov 2006 16:47:09 +0000 (16:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43200 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/auibook.cpp

index bc62aaef78fffdd0566554d56d00b352c5354881..faf1c52a02affa7f34edb72f9836d78ff13954fd 100644 (file)
@@ -1651,6 +1651,9 @@ void wxAuiTabContainer::Render(wxDC* raw_dc, wxWindow* wnd)
         offset += m_art->GetIndentSize();     
     
     // prepare the tab-close-button array
         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;
     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);
     }
     
         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)
             break;
 
         if (rect.width <= 0)
             break;
 
-
-
-
         m_art->DrawTab(dc,
                        wnd,
                        rect,
         m_art->DrawTab(dc,
                        wnd,
                        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
     if (active >= m_tab_offset && active < m_pages.GetCount())
     {
     // draw the active tab again so it stands in the foreground
     if (active >= m_tab_offset && active < m_pages.GetCount())
     {