summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-30 21:28:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-31 17:46:27 +0200
commit91d8af2c5cf4e8ec0f1ce0e532e0c896de77750b (patch)
treeeed79118bb584a5b57419a4f771d350280380381
parent2a0d8106a558845357d39648656e08ec6f091cf8 (diff)
focus rect for value set
Change-Id: I208cf42db4256bb7286222781cf2bf29f843c673 Reviewed-on: https://gerrit.libreoffice.org/55122 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/outdev.hxx2
-rw-r--r--svtools/source/control/valueset.cxx4
-rw-r--r--vcl/source/app/salvtables.cxx2
-rw-r--r--vcl/source/window/window2.cxx7
4 files changed, 14 insertions, 1 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index bd4af96456aa..174987e51757 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -308,6 +308,8 @@ namespace vcl {
typedef OutputDevice RenderContext;
}
+VCL_DLLPUBLIC void DrawFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, int nBorder = 1);
+
/**
* Some things multiple-inherit from VclAbstractDialog and OutputDevice,
* so we need to use virtual inheritance to keep the referencing counting
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 3c8e5cbcc753..dc5e52896641 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -3244,6 +3244,8 @@ void SvtValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16
WinBits nStyle = GetStyle();
if (nStyle & WB_MENUSTYLEVALUESET)
{
+ if (bFocus)
+ DrawFocusRect(rRenderContext, aRect);
if (bDrawSel)
{
rRenderContext.SetLineColor(mbBlackSel ? COL_BLACK : aDoubleColor);
@@ -3296,6 +3298,8 @@ void SvtValueSet::ImplDrawSelect(vcl::RenderContext& rRenderContext, sal_uInt16
rRenderContext.SetLineColor(COL_LIGHTGRAY);
}
rRenderContext.DrawRect(aRect2);
+ if (bFocus)
+ DrawFocusRect(rRenderContext, aRect2);
}
ImplDrawItemText(rRenderContext, pItem->maText);
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 260e6c056c4c..065818715ff4 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1853,7 +1853,7 @@ IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
m_aDrawHdl.Call(aPayload);
tools::Rectangle aFocusRect(m_aGetFocusRectHdl.Call(*this));
if (!aFocusRect.IsEmpty())
- aPayload.first.Invert(aFocusRect, InvertFlags(0xffff));
+ DrawFocusRect(aPayload.first, aFocusRect);
}
IMPL_LINK(SalInstanceDrawingArea, ResizeHdl, const Size&, rSize, void)
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 8b7e07dbc19e..bdef8b58c215 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -2006,5 +2006,12 @@ const std::vector<VclPtr<FixedText> >& Window::list_mnemonic_labels() const
} /* namespace vcl */
+void DrawFocusRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, int nBorder)
+{
+ rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
+ rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Bottom()-nBorder+1), Size(rRect.GetWidth(), nBorder)), InvertFlags::N50);
+ rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(), rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
+ rRenderContext.Invert(tools::Rectangle(Point(rRect.Right()-nBorder+1, rRect.Top()+nBorder), Size(nBorder, rRect.GetHeight()-(nBorder*2))), InvertFlags::N50);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */