vcl/source/control/imivctl1.cxx |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 6a3f91c4e9c669fc445eab8f3c526233cd68fdb9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Jul 11 10:41:02 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jul 11 17:51:44 2024 +0200

    tdf#161026 tdf#161355 icon choice ctrl: Draw icon + text at the end
    
    Draw the entry's icon and text after drawing other things, to
    make sure it is on top, i.e. always visible.
    
    This shouldn't make any difference by itself yet as currently
    only frames/borders are drawn after it, but that will change
    with an upcoming commit to use the native drawing API for
    taking care of at least the highlighting part.
    
    Change-Id: I97cebdf2470ea1ab92e56642e4b4fd4255542994
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170340
    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 37410ae91cf0..eabe1ab83106 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -1062,11 +1062,6 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
         vcl::RenderTools::DrawSelectionBackground(rRenderContext, *pView, 
CalcFocusRect(pEntry),
                                                   bActiveSelection ? 1 : 2, 
false, false, false);
 
-
-    PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, 
rRenderContext);
-
-    PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, 
rRenderContext);
-
     if (pEntry->IsFocused())
         DrawFocusRect(rRenderContext, pEntry);
 
@@ -1074,6 +1069,9 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
     if (pEntry == pCurHighlightFrame)
         DrawHighlightFrame(rRenderContext, CalcFocusRect(pEntry));
 
+    PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, 
rRenderContext);
+    PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, 
rRenderContext);
+
     rRenderContext.Pop();
     if (bResetClipRegion)
         rRenderContext.SetClipRegion();
commit 5db251640b24747a349eec2c3e53902f3f91eec9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Jul 11 10:09:45 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jul 11 17:51:37 2024 +0200

    icon choice ctrl: Decouple focus from text/icon drawing
    
    Move focus drawing out of `SvxIconChoiceCtrl_Impl::PaintItem`,
    where it was drawn for the `IcnViewFieldType::Text` case,
    since that's not actually related to drawing the text.
    
    Move it to just after the (only) call to
    `SvxIconChoiceCtrl_Impl::PaintItem` with the
    `IcnViewFieldType::Text` parameter instead.
    
    Change-Id: I7c2bda33cb9107535569492db70d3b23b9280a09
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170339
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 6f42c5c93280..37410ae91cf0 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -991,9 +991,6 @@ void SvxIconChoiceCtrl_Impl::PaintItem(const 
tools::Rectangle& rRect,
     if (eItem == IcnViewFieldType::Text)
     {
         rRenderContext.DrawText(rRect, pEntry->GetText(), nCurTextDrawFlags);
-
-        if (pEntry->IsFocused())
-            DrawFocusRect(rRenderContext, pEntry);
     }
     else
     {
@@ -1070,6 +1067,9 @@ void 
SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Po
 
     PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, 
rRenderContext);
 
+    if (pEntry->IsFocused())
+        DrawFocusRect(rRenderContext, pEntry);
+
     // draw highlight frame
     if (pEntry == pCurHighlightFrame)
         DrawHighlightFrame(rRenderContext, CalcFocusRect(pEntry));

Reply via email to