From 2d45f87330ef7011711767cc736829e4082b236b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 2 May 2018 21:21:36 +0100 Subject: support native focus for drawing sub region MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9862f060b9d5b2c3015c084060887f2d66f1ed01 Reviewed-on: https://gerrit.libreoffice.org/53768 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svx/source/dialog/dlgctrl.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index a4d31925d242..d091a121023d 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -684,6 +684,7 @@ RectCtl::RectCtl(weld::Builder& rBuilder, const OString& rDrawingId, SvxTabPage* m_xControl->connect_key_press(LINK(this, RectCtl, DoKeyDown)); m_xControl->connect_focus_in(LINK(this, RectCtl, DoGetFocus)); m_xControl->connect_focus_out(LINK(this, RectCtl, DoLoseFocus)); + m_xControl->connect_focus_rect(LINK(this, RectCtl, DoFocusRect)); m_xControl->set_size_request(m_xControl->get_approximate_digit_width() * 25, m_xControl->get_text_height() * 5); Resize_Impl(); @@ -976,12 +977,14 @@ IMPL_LINK(RectCtl, DoPaint, weld::DrawingArea::draw_args, aPayload, void) rRenderContext.DrawBitmap(aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap.GetBitmap()); } } +} - if (m_xControl->has_focus()) - { - tools::Rectangle aFocusRect(CalculateFocusRectangle()); - rRenderContext.Invert(aFocusRect, InvertFlags(0xffff)); - } +IMPL_LINK(RectCtl, DoFocusRect, weld::Widget&, rControl, tools::Rectangle) +{ + tools::Rectangle aRet; + if (rControl.has_focus()) + aRet = CalculateFocusRectangle(); + return aRet; } // Convert RectPoint Point -- cgit