From 67fd47e909aa88584420c3351ab17308aeb4e911 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Tue, 14 May 2019 02:48:37 +0200 Subject: tdf#125454 SM use theming for element list This uses the same background color then the edit entries and changes the focus from the gray filled rectangle to a non-filled rectangle using the general highlight color. Change-Id: I4b44811e768266ccd2081a8e3ef61483a803da3b Reviewed-on: https://gerrit.libreoffice.org/72795 Reviewed-by: Heiko Tietze Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- starmath/inc/ElementsDockingWindow.hxx | 1 + starmath/source/ElementsDockingWindow.cxx | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'starmath') diff --git a/starmath/inc/ElementsDockingWindow.hxx b/starmath/inc/ElementsDockingWindow.hxx index 874735a8a44f..c68d442bef3d 100644 --- a/starmath/inc/ElementsDockingWindow.hxx +++ b/starmath/inc/ElementsDockingWindow.hxx @@ -73,6 +73,7 @@ class SmElementsControl : public Control static const std::pair aOthers[]; virtual void ApplySettings(vcl::RenderContext&) override; + virtual void DataChanged(const DataChangedEvent&) override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; virtual void MouseButtonDown(const MouseEvent& rMEvt) override; virtual void MouseMove(const MouseEvent& rMEvt) override; diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 385d33d795b5..43948cd18106 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -378,9 +378,10 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext) if (pCurrentElement == element) { pContext->Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR); - pContext->SetFillColor(Color(230, 230, 230)); - pContext->SetLineColor(Color(230, 230, 230)); - + const StyleSettings& rStyleSettings = pContext->GetSettings().GetStyleSettings(); + pContext->SetLineColor(rStyleSettings.GetHighlightColor()); + pContext->SetFillColor(COL_TRANSPARENT); + pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 1, y + 1, x + boxX - 1, y + boxY - 1))); pContext->DrawRect(PixelToLogic(tools::Rectangle(x + 2, y + 2, x + boxX - 2, y + boxY - 2))); pContext->Pop(); } @@ -452,7 +453,21 @@ void SmElementsControl::Resize() void SmElementsControl::ApplySettings(vcl::RenderContext& rRenderContext) { - rRenderContext.SetBackground(COL_WHITE); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); + rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); +} + +void SmElementsControl::DataChanged(const DataChangedEvent& rDCEvt) +{ + Window::DataChanged(rDCEvt); + + if (!((rDCEvt.GetType() == DataChangedEventType::FONTS) || + (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) || + ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && + (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)))) + return; + + Invalidate(); } void SmElementsControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) -- cgit