From f822b613c19bbabcb485097232ddaadf501e6b43 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 27 Nov 2019 11:25:02 +0000 Subject: tdf#129042 factor the wizard buttons into the desired min width MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib89e8813c6f8e5203708952215156d3d5281ad17 Reviewed-on: https://gerrit.libreoffice.org/83893 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/control/wizardmachine.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'vcl/source/control/wizardmachine.cxx') diff --git a/vcl/source/control/wizardmachine.cxx b/vcl/source/control/wizardmachine.cxx index c61b46ec24e9..2fced940867e 100644 --- a/vcl/source/control/wizardmachine.cxx +++ b/vcl/source/control/wizardmachine.cxx @@ -104,19 +104,26 @@ namespace vcl void RoadmapWizard::ImplCalcSize( Size& rSize ) { - // calculate ButtonBar height + // calculate ButtonBar height and width long nMaxHeight = 0; + long nBarWidth = WIZARDDIALOG_BUTTON_DLGOFFSET_X * 2 + LogicalCoordinateToPixel(6); ImplWizButtonData* pBtnData = mpFirstBtn; - while ( pBtnData ) + while (pBtnData) { - long nBtnHeight = pBtnData->mpButton->GetSizePixel().Height(); + auto nBtnHeight = pBtnData->mpButton->GetSizePixel().Height(); + auto nBtnWidth = pBtnData->mpButton->GetSizePixel().Width(); + if (pBtnData->mpButton->IsVisible()) + { + nBarWidth += nBtnWidth; + nBarWidth += pBtnData->mnOffset; + } if ( nBtnHeight > nMaxHeight ) nMaxHeight = nBtnHeight; pBtnData = pBtnData->mpNext; } if ( nMaxHeight ) nMaxHeight += WIZARDDIALOG_BUTTON_OFFSET_Y*2; - rSize.AdjustHeight(nMaxHeight ); + rSize.AdjustHeight(nMaxHeight); // add in the view window size if ( mpViewWindow && mpViewWindow->IsVisible() ) @@ -131,6 +138,9 @@ namespace vcl else if ( meViewAlign == WindowAlign::Right ) rSize.AdjustWidth(aViewSize.Width() ); } + + if (nBarWidth > rSize.Width()) + rSize.setWidth(nBarWidth); } void RoadmapWizard::queue_resize(StateChangedType /*eReason*/) -- cgit