From dffde8403e0bb81d7eb3b7853cece187e1d36c62 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Mar 2023 09:50:19 +0000 Subject: allow more than DrawingArea to report style updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I791e4ad45daeeb77ca25e36ae6520168b2ece044 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148980 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/source/app/salvtables.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'vcl/source/app') diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index f9a6cfc75dc2..61fa56dd3223 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -580,6 +580,25 @@ void SalInstanceWidget::connect_key_release(const Link& r weld::Widget::connect_key_release(rLink); } +IMPL_LINK(SalInstanceWidget, SettingsChangedHdl, VclWindowEvent&, rEvent, void) +{ + if (rEvent.GetId() != VclEventId::WindowDataChanged) + return; + + DataChangedEvent* pData = static_cast(rEvent.GetData()); + if (pData->GetType() == DataChangedEventType::SETTINGS) + m_aStyleUpdatedHdl.Call(*this); +} + +void SalInstanceWidget::connect_style_updated(const Link& rLink) +{ + if (m_aStyleUpdatedHdl.IsSet()) + m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, SettingsChangedHdl)); + weld::Widget::connect_style_updated(rLink); + if (m_aStyleUpdatedHdl.IsSet()) + m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, SettingsChangedHdl)); +} + bool SalInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& x, int& y, int& width, int& height) const { @@ -633,6 +652,8 @@ void SalInstanceWidget::queue_resize() { m_xWidget->queue_resize(); } SalInstanceWidget::~SalInstanceWidget() { + if (m_aStyleUpdatedHdl.IsSet()) + m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, SettingsChangedHdl)); if (m_aMnemonicActivateHdl.IsSet()) m_xWidget->SetMnemonicActivateHdl(Link()); if (m_bMouseEventListener) @@ -6233,6 +6254,11 @@ void SalInstanceDrawingArea::connect_key_release(const Link& rLink) +{ + weld::Widget::connect_style_updated(rLink); +} + void SalInstanceDrawingArea::set_cursor(PointerStyle ePointerStyle) { m_xDrawingArea->SetPointer(ePointerStyle); -- cgit