summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-11-01 20:45:20 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-11-02 14:54:50 +0100
commitb6ef68cdaa51ca5c9fdab40ade97f4a0f18da51b (patch)
tree145d43bf9aa61f977e4b1fd04bbd76ff2e648bcc /svtools
parent5fbc81640770dfe11907b2f92f3ae455e582a302 (diff)
keep showing focus rect on the first element during highlight
for the case nothing is selected but non-hover shows the bare focus rect to indicate focus is in the valueset though nothing is truly selected Change-Id: Ibe7fa38711f935126e1c0803c395b43b9720ca6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124575 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/control/valueset.cxx32
1 files changed, 21 insertions, 11 deletions
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 2afd1dfdeb57..f8b0267316aa 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1178,13 +1178,9 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext)
return;
const bool bFocus = HasFocus();
- const bool bDrawSel = !mbNoSelection || mbHighlight;
- if (!bFocus && !bDrawSel)
- {
- ImplDrawItemText(rRenderContext, OUString());
+ if (!bFocus && mbNoSelection && !mbHighlight)
return;
- }
tools::Rectangle aSelectedRect, aHoverRect;
ValueSetItem* pSelectedItem = ImplGetDrawSelectItem(mnSelItemId, bFocus, aSelectedRect);
@@ -1192,12 +1188,26 @@ void ValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext)
if (pSelectedItem)
{
- const bool bHover = mnHighItemId && pSelectedItem == pHighlightItem;
- ImplDrawSelect(rRenderContext, aSelectedRect, pSelectedItem, bFocus, bDrawSel, true, bHover);
- }
- if (mnHighItemId && pHighlightItem && pSelectedItem != pHighlightItem)
- {
- ImplDrawSelect(rRenderContext, aHoverRect, pHighlightItem, false, bDrawSel, false, true);
+ const bool bHover = pSelectedItem == pHighlightItem;
+ ImplDrawSelect(rRenderContext, aSelectedRect, pSelectedItem, bFocus, !mbNoSelection, true, bHover);
+ }
+ if (pHighlightItem && (pSelectedItem != pHighlightItem || mbNoSelection))
+ {
+ // For the case that there isn't a selected item, but due to wanting to
+ // show focus is in the valueset, the above block will have drawn the
+ // first item with a focus rect. For that situation; if the valueset is
+ // the thin WB_MENUSTYLEVALUESET case then blend this highlight border
+ // on top of that focus rect and it will appear with a highlighted
+ // focus rect. If it's the other case of a thicker border then redraw
+ // the focus rect highlighted with the hover color.
+ bool bDrawFocus;
+ WinBits nStyle = GetStyle();
+ if (nStyle & WB_MENUSTYLEVALUESET)
+ bDrawFocus = false;
+ else
+ bDrawFocus = pSelectedItem == pHighlightItem && mbNoSelection;
+
+ ImplDrawSelect(rRenderContext, aHoverRect, pHighlightItem, bDrawFocus, mbHighlight, false, true);
}
}