Run wxListbook::OnSize() after creation under all platforms

This was previously done only for wxMSW but is also necessary for wxOSX to
ensure that the icons in the list view part are arranged and shown correctly
initially, otherwise the selected item could be only partially visible.
This commit is contained in:
Vadim Zeitlin
2015-10-18 03:55:32 +02:00
parent cff9316e57
commit bc4382a9dd

View File

@@ -95,16 +95,10 @@ wxListbook::Create(wxWindow *parent,
if ( GetListView()->InReportView() )
GetListView()->InsertColumn(0, wxS("Pages"));
#ifdef __WXMSW__
// On XP with themes enabled the GetViewRect used in GetControllerSize() 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 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.
wxSizeEvent evt;
GetEventHandler()->AddPendingEvent(evt);
#endif
// Ensure that we rearrange the items in our list view after all the pages
// are added.
PostSizeEvent();
return true;
}