- event.Skip();
-
- if ( !m_list )
- {
- // we're not fully created yet
- return;
- }
-
- // resize the list control and the page area to fit inside our new size
- const wxSize sizeClient = GetClientSize(),
- sizeList = GetListSize();
-
- wxPoint posList;
- switch ( GetWindowStyle() & wxLB_ALIGN_MASK )
- {
- default:
- wxFAIL_MSG( _T("unexpected wxListbook alignment") );
- // fall through
-
- case wxLB_TOP:
- case wxLB_LEFT:
- // posList is already ok
- break;
-
- case wxLB_BOTTOM:
- posList.y = sizeClient.y - sizeList.y;
- break;
-
- case wxLB_RIGHT:
- posList.x = sizeClient.x - sizeList.x;
- break;
- }
-
- m_list->Move(posList.x, posList.y);
- m_list->SetClientSize(sizeList.x, sizeList.y);
-
- if ( m_line )
- {
- wxRect rectLine(wxPoint(0, 0), sizeClient);
-
- switch ( GetWindowStyle() & wxLB_ALIGN_MASK )
- {
- case wxLB_TOP:
- rectLine.y = sizeList.y + 1;
- rectLine.height = MARGIN - 2;
- break;
-
- case wxLB_BOTTOM:
- rectLine.height = MARGIN - 2;
- rectLine.y = sizeClient.y - sizeList.y - rectLine.height;
- break;
-
- case wxLB_LEFT:
- rectLine.x = sizeList.x + 1;
- rectLine.width = MARGIN - 2;
- break;
-
- case wxLB_RIGHT:
- rectLine.width = MARGIN - 2;
- rectLine.x = sizeClient.x - sizeList.x - rectLine.width;
- break;
- }
-
- m_line->SetSize(rectLine);
- }
-
- // we should always have some selection if possible
- if ( m_selection == wxNOT_FOUND && GetPageCount() )
- {
- SetSelection(0);
- }
-
- if ( m_selection != wxNOT_FOUND )
- {
- wxWindow *page = m_pages[m_selection];
- wxCHECK_RET( page, _T("NULL page in wxListbook?") );
-
- page->SetSize(GetPageRect());
- if ( !page->IsShown() )
- {
- page->Show();
- }
- }
+ // 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)
+ wxListView *list = GetListView();
+ if (list) list->Arrange();
+ wxBookCtrlBase::OnSize(event);