vcl/source/control/imivctl1.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 8708e8cf90d0ac0acbbce34b82f10ef7352d5062
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Jul 11 10:47:50 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jul 11 17:58:35 2024 +0200

    tdf#161026 tdf#161355 tdf#161501 icon choice ctrl: Natively draw mouse-hover
    
    ... 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.l...@gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

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);

Reply via email to