diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-07-11 10:47:50 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-07-11 17:58:35 +0200 |
commit | 8708e8cf90d0ac0acbbce34b82f10ef7352d5062 (patch) | |
tree | 29cbbbc2d06a1f7901fef6c5548103ce6f4d01b2 | |
parent | 6a3f91c4e9c669fc445eab8f3c526233cd68fdb9 (diff) |
... feedback.
Instead of always using `SvxIconChoiceCtrl_Impl::DrawHighlightFrame`
to draw a frame around the currently mouse-hovered item in
the icon choice control/vertical tab page, use the native
drawing API to let the backends draw a `ControlType::TabItem`
with the `ControlState::ROLLOVER` state set.
This also aligns this more with the horizontal tabbar used in other dialogs
(s. `TabControl::ImplDrawItem`).
With this commit in place, the hovered vertical tab in
e.g. the "Insert" -> "Hyperlink" or "Format" -> "Page" vertical
tab dialogs is now displayed "properly" and in line with what
happens for non-vertical tab pages (like the "Format" -> "Paragraph"
one) on Windows or with the Breeze and Breeze Dark themes and
the kf5 VCL plugin on Linux.
Instead of just using the native drawing API for the mouse-hover
feedback, this could likely be extended to also take care of focus,
selection, etc. in a follow-up step.
Change-Id: I5437d18cb78e8da0736c9ab920c55b90af4d0e25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170341
Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com>
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | vcl/source/control/imivctl1.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index eabe1ab83106..f5ef978c1184 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -1065,9 +1065,23 @@ void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po if (pEntry->IsFocused()) DrawFocusRect(rRenderContext, pEntry); - // draw highlight frame + // highlight mouse-hovered entry if (pEntry == pCurHighlightFrame) - DrawHighlightFrame(rRenderContext, CalcFocusRect(pEntry)); + { + const tools::Rectangle aRect = CalcFocusRect(pEntry); + bool bNativeOK + = rRenderContext.IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire); + if (bNativeOK) + { + ControlState nState = ControlState::ENABLED | ControlState::ROLLOVER; + TabitemValue tiValue(aRect); + bNativeOK = rRenderContext.DrawNativeControl(ControlType::TabItem, ControlPart::Entire, + aRect, nState, tiValue, OUString()); + } + + if (!bNativeOK) + DrawHighlightFrame(rRenderContext, aRect); + } PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, rRenderContext); PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, rRenderContext); |