vcl/source/control/imivctl1.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 24103bdf3fa3d6962efcc6fb6ee5c95b62e29cc4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Jul 18 08:58:10 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 19 06:05:00 2024 +0200

    tdf#161501 icon choice ctrl: Use tab text colors
    
    Instead of using the generic window or highlight
    text color, use the specific text colors for tabs
    when painting entries of the vertical tab control,
    similar to how it's done for the non-vertical
    tab control (see `TabControl::ImplDrawItem`).
    
    This is also in preparation for changes to make more
    use of the system colors for the entries.
    
    It e.g. ensures that black text color is used for the
    text of the focused entry with Breeze (light) in my Debian
    testing KDE Plasma 5 setup with Rafael's pending change [1],
    preventing the issue of too low contrast mentioned in [2]
    that is otherwise seen in my setup, but not Rafael's for some
    reason.
    
    [1] https://gerrit.libreoffice.org/c/core/+/170554
    [2] 
https://gerrit.libreoffice.org/c/core/+/170554/comments/f9d0f988_6a0f5eec
    
    Change-Id: I718d08f717bd896b7fca9fc39eedae68fba4bd25
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170677
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Rafael Lima <rafael.palma.l...@gmail.com>
    Tested-by: Jenkins

diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index ed76c87cc80b..f14663e3f6fc 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -1005,8 +1005,6 @@ void SvxIconChoiceCtrl_Impl::PaintItem(const 
tools::Rectangle& rRect,
 
 void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const 
Point& rPos, vcl::RenderContext& rRenderContext)
 {
-    bool bSelected = pEntry->IsSelected();
-
     rRenderContext.Push(vcl::PushFlags::FONT | vcl::PushFlags::TEXTCOLOR);
 
     tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos));
@@ -1014,6 +1012,8 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
 
     bool bActiveSelection = (0 != (nWinBits & WB_NOHIDESELECTION)) || 
pView->HasFocus();
 
+    const bool bMouseHovered = pEntry == pCurHighlightFrame;
+    const bool bSelected = pEntry->IsSelected();
     if (bSelected)
     {
         const StyleSettings& rSettings = 
rRenderContext.GetSettings().GetStyleSettings();
@@ -1026,11 +1026,12 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
         else
             aNewFont.SetFillColor(rSettings.GetDeactiveColor());
 
-        Color aWinCol = rSettings.GetWindowTextColor();
-        if (!bActiveSelection && rSettings.GetFaceColor().IsBright() == 
aWinCol.IsBright())
-            aNewFont.SetColor(rSettings.GetWindowTextColor());
-        else
-            aNewFont.SetColor(rSettings.GetHighlightTextColor());
+        Color aTextColor(rSettings.GetTabTextColor());
+        if (bSelected)
+            aTextColor = rSettings.GetTabHighlightTextColor();
+        else if (bMouseHovered)
+            aTextColor = rSettings.GetTabRolloverTextColor();
+        aNewFont.SetColor(aTextColor);
 
         rRenderContext.SetFont(aNewFont);
 
@@ -1066,7 +1067,7 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
         DrawFocusRect(rRenderContext, pEntry);
 
     // highlight mouse-hovered entry
-    if (pEntry == pCurHighlightFrame)
+    if (bMouseHovered)
     {
         const tools::Rectangle aRect = CalcFocusRect(pEntry);
         bool bNativeOK

Reply via email to