diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-10-27 16:14:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-10-27 20:24:39 +0200 |
commit | ca482cf39f25941040596e50d0e1ab7fa25dc1dd (patch) | |
tree | d62c5c9ff4f1c8a6f18e43b23e70dcb62d615743 /vcl | |
parent | eec48130271188cab63665acedbabf1ff5e850a2 (diff) |
calculate the header bounds even for !bPaneWithHeader case
so we can pass in the required area for the macOS case
Change-Id: Ibb170e773a57ad0d5d0a591810e4039591337303
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141911
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 0a9d3677fe2f..b5d4d4cde0e2 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1131,19 +1131,25 @@ void TabControl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectang { const bool bPaneWithHeader = mbShowTabs && rRenderContext.IsNativeControlSupported(ControlType::TabPane, ControlPart::TabPaneWithHeader); tools::Rectangle aHeaderRect(aRect.Left(), 0, aRect.Right(), aRect.Top()); - if (bPaneWithHeader) + + if (mpTabCtrlData->maItemList.size()) { - aRect.SetTop(0); - if (mpTabCtrlData->maItemList.size()) + tools::Long nLeft = LONG_MAX; + tools::Long nRight = 0; + for (const auto &item : mpTabCtrlData->maItemList) { - tools::Long nRight = 0; - for (const auto &item : mpTabCtrlData->maItemList) - if (item.m_bVisible) - nRight = item.maRect.Right(); - assert(nRight); - aHeaderRect.SetRight(nRight); + if (!item.m_bVisible) + continue; + nRight = std::max(nRight, item.maRect.Right()); + nLeft = std::min(nLeft, item.maRect.Left()); } + aHeaderRect.SetLeft(nLeft); + aHeaderRect.SetRight(nRight); } + + if (bPaneWithHeader) + aRect.SetTop(0); + const TabPaneValue aTabPaneValue(aHeaderRect, pCurItem ? pCurItem->maRect : tools::Rectangle()); ControlState nState = ControlState::ENABLED; |