Selection should be set to -1 if all pages are deleted, or the next

insertion will try to set the selection to 1.
Fixed lack of initial controller resize when first page is added,
though I think the listctrl should probably always have a decent initial
height even when empty.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2006-05-18 09:53:19 +00:00
parent 52f15cb7bb
commit 6a82a0d041

View File

@ -301,7 +301,14 @@ wxListbook::InsertPage(size_t n,
SetSelection(selNew);
InvalidateBestSize();
// GetListView()->InvalidateBestSize();
GetListView()->Arrange();
if (GetPageCount() == 1)
{
wxSizeEvent sz(GetSize(), GetId());
ProcessEvent(sz);
}
return true;
}
@ -331,6 +338,11 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
}
GetListView()->Arrange();
if (GetPageCount() == 0)
{
wxSizeEvent sz(GetSize(), GetId());
ProcessEvent(sz);
}
}
return win;
@ -340,7 +352,15 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
bool wxListbook::DeleteAllPages()
{
GetListView()->DeleteAllItems();
return wxBookCtrlBase::DeleteAllPages();
if (!wxBookCtrlBase::DeleteAllPages())
return false;
m_selection = -1;
wxSizeEvent sz(GetSize(), GetId());
ProcessEvent(sz);
return true;
}
// ----------------------------------------------------------------------------