From 905069b18f8e2bbed946e429830446bb29828b14 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 13 Jul 2008 18:01:12 +0000 Subject: [PATCH] relay out the control after deleting any page, not just the last one (#9684); also extract the size event sending code in a separate function to be able to replace it with something better easier later git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listbkg.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/generic/listbkg.cpp b/src/generic/listbkg.cpp index 82a1220c32..487b6494a2 100644 --- a/src/generic/listbkg.cpp +++ b/src/generic/listbkg.cpp @@ -185,9 +185,11 @@ void wxListbook::OnSize(wxSizeEvent& event) // 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); + wxListView * const list = GetListView(); + if ( list ) + list->Arrange(); + + event.Skip(); } int wxListbook::HitTest(const wxPoint& pt, long *flags) const @@ -247,6 +249,13 @@ wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const return size; } +void wxListbook::UpdateSize() +{ + // we should find a more elegant way to force a layout than generating this + // dummy event + wxSizeEvent sz(GetSize(), GetId()); + GetEventHandler()->ProcessEvent(sz); +} // ---------------------------------------------------------------------------- // accessing the pages @@ -412,9 +421,8 @@ wxListbook::InsertPage(size_t n, if ( selNew != -1 ) SetSelection(selNew); - wxSizeEvent sz(GetSize(), GetId()); - GetEventHandler()->ProcessEvent(sz); - + UpdateSize(); + return true; } @@ -444,11 +452,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page) } GetListView()->Arrange(); - if (GetPageCount() == 0) - { - wxSizeEvent sz(GetSize(), GetId()); - GetEventHandler()->ProcessEvent(sz); - } + UpdateSize(); } return win; @@ -463,8 +467,7 @@ bool wxListbook::DeleteAllPages() m_selection = -1; - wxSizeEvent sz(GetSize(), GetId()); - GetEventHandler()->ProcessEvent(sz); + UpdateSize(); return true; } -- 2.47.2