]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listbkg.cpp
refactoring in preparation for further changes: moved data in a private struct, let...
[wxWidgets.git] / src / generic / listbkg.cpp
index da6e71c5d102200578a524c3c3dcbb24943b4f58..fdbe49e578eb03699bcc87a5d00d64220fdebf6c 100644 (file)
@@ -134,7 +134,7 @@ wxListbook::Create(wxWindow *parent,
 #ifdef __WXMSW__
     // On XP with themes enabled the GetViewRect used in GetListSize to
     // determine the space needed for the list view will incorrectly return
-    // (0,0,0,0) the first time.  So send a pending event so OnSize wiull be
+    // (0,0,0,0) the first time.  So send a pending event so OnSize will be
     // called again after the window is ready to go.  Technically we don't
     // need to do this on non-XP windows, but if things are already sized
     // correctly then nothing changes and so there is no harm.
@@ -235,7 +235,14 @@ void wxListbook::OnSize(wxSizeEvent& event)
             break;
     }
 
-    m_list->Move(posList.x, posList.y);
+    // arrange the icons before calling SetClientSize(), otherwise it wouldn't
+    // account for the scrollbars the list control might need and, at least
+    // under MSW, we'd finish with an ugly looking list control with both
+    // vertical and horizontal scrollbar (with one of them being added because
+    // the other one is not accounted for in client size computations)
+    m_list->Arrange();
+    if ( m_list->GetPosition() != posList )
+        m_list->Move(posList.x, posList.y);
     m_list->SetClientSize(sizeList.x, sizeList.y);
 
 #if wxUSE_LINE_IN_LISTBOOK
@@ -276,7 +283,7 @@ void wxListbook::OnSize(wxSizeEvent& event)
         wxWindow *page = m_pages[m_selection];
         wxCHECK_RET( page, _T("NULL page in wxListbook?") );
         page->SetSize(GetPageRect());
-        }
+    }
 }
 
 wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const