From c52ed0bf6d0e1f570da2ffcc244495d70318132b Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Fri, 24 Aug 2018 17:16:58 +0200 Subject: [PATCH] [escher] Allow customizing the background color of a button --- escher/include/escher/button.h | 2 ++ escher/src/button.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/escher/include/escher/button.h b/escher/include/escher/button.h index 9722c0a5f..fc3633a98 100644 --- a/escher/include/escher/button.h +++ b/escher/include/escher/button.h @@ -6,6 +6,7 @@ #include #include #include +#include class Button : public HighlightCell, public Responder { public: @@ -13,6 +14,7 @@ public: void setMessage(I18n::Message message); bool handleEvent(Ion::Events::Event event) override; void setHighlighted(bool highlight) override; + virtual KDColor highlightedBackgroundColor() const { return Palette::Select; } Responder * responder() override { return this; } diff --git a/escher/src/button.cpp b/escher/src/button.cpp index 97dd9814e..1f2bbf33f 100644 --- a/escher/src/button.cpp +++ b/escher/src/button.cpp @@ -38,7 +38,7 @@ bool Button::handleEvent(Ion::Events::Event event) { void Button::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::Select : KDColorWhite; + KDColor backgroundColor = highlight? highlightedBackgroundColor() : KDColorWhite; m_messageTextView.setBackgroundColor(backgroundColor); markRectAsDirty(bounds()); }