From a671974babbf89cacd7c0d868589dc975eb06008 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 3 Dec 2017 10:04:23 -0800 Subject: [PATCH] Fix ribbon page layout wrong when scroll button is shown or hidden due to a scroll operation See #17454 --- include/wx/ribbon/page.h | 2 +- src/ribbon/page.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/wx/ribbon/page.h b/include/wx/ribbon/page.h index 3a047b7be6..cbddb82211 100644 --- a/include/wx/ribbon/page.h +++ b/include/wx/ribbon/page.h @@ -75,7 +75,7 @@ protected: bool ExpandPanels(wxOrientation direction, int maximum_amount); bool CollapsePanels(wxOrientation direction, int minimum_amount); - void ShowScrollButtons(); + bool ShowScrollButtons(); void HideScrollButtons(); void CommonInit(const wxString& label, const wxBitmap& icon); diff --git a/src/ribbon/page.cpp b/src/ribbon/page.cpp index 678d1d91ea..ee54aa478b 100644 --- a/src/ribbon/page.cpp +++ b/src/ribbon/page.cpp @@ -338,7 +338,8 @@ bool wxRibbonPage::ScrollPixels(int pixels) child->SetPosition(wxPoint(x, y)); } - ShowScrollButtons(); + if (ShowScrollButtons()) + DoActualLayout(); Refresh(); return true; } @@ -788,7 +789,7 @@ void wxRibbonPage::HideScrollButtons() ShowScrollButtons(); } -void wxRibbonPage::ShowScrollButtons() +bool wxRibbonPage::ShowScrollButtons() { bool show_left = true; bool show_right = true; @@ -891,6 +892,8 @@ void wxRibbonPage::ShowScrollButtons() { wxDynamicCast(GetParent(), wxRibbonBar)->RepositionPage(this); } + + return reposition; } static int GetSizeInOrientation(wxSize size, wxOrientation orientation)