support native focus for drawing sub region
Change-Id: I9862f060b9d5b2c3015c084060887f2d66f1ed01 Reviewed-on: https://gerrit.libreoffice.org/53768 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
7e64aaebce
commit
2d45f87330
@ -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;}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user