diff options
-rw-r--r-- | include/svx/dlgctrl.hxx | 1 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 5 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 13 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 3 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 7 |
5 files changed, 24 insertions, 5 deletions
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 075a008fe0c0..1f2a17f9feb7 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -194,6 +194,7 @@ public: DECL_LINK(DoGetFocus, weld::Widget&, void); DECL_LINK(DoLoseFocus, weld::Widget&, void); DECL_LINK(MarkToResetSettings, weld::Widget&, void); + DECL_LINK(DoFocusRect, weld::Widget&, tools::Rectangle); void Reset(); RectPoint GetActualRP() const { return eRP;} diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 309c1447a80d..9e58e585a533 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -701,6 +701,7 @@ protected: Link<const KeyEvent&, bool> m_aKeyPressHdl; Link<const KeyEvent&, bool> m_aKeyReleaseHdl; Link<Widget&, void> m_aStyleUpdatedHdl; + Link<Widget&, tools::Rectangle> m_aGetFocusRectHdl; public: void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; } @@ -720,6 +721,10 @@ public: void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; } void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; } void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; } + void connect_focus_rect(const Link<Widget&, tools::Rectangle>& rLink) + { + m_aGetFocusRectHdl = rLink; + } virtual void queue_draw() = 0; virtual void queue_draw_area(int x, int y, int width, int height) = 0; virtual a11yref get_accessible_parent() = 0; 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 diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 8af07394c310..818ef8b778b4 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1683,6 +1683,9 @@ public: 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)); } IMPL_LINK(SalInstanceDrawingArea, ResizeHdl, const Size&, rSize, void) diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index b33013916a85..ed78e141b124 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3506,6 +3506,13 @@ private: cairo_set_source_surface(cr, m_pSurface, 0, 0); cairo_paint(cr); + + tools::Rectangle aFocusRect(m_aGetFocusRectHdl.Call(*this)); + if (!aFocusRect.IsEmpty()) + { + gtk_render_focus(gtk_widget_get_style_context(GTK_WIDGET(m_pDrawingArea)), cr, + aFocusRect.Left(), aFocusRect.Top(), aFocusRect.GetWidth(), aFocusRect.GetHeight()); + } } static void signalSizeAllocate(GtkWidget*, GdkRectangle* allocation, gpointer widget) { |