mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[escher] Allow customizing the background color of a button
This commit is contained in:
committed by
LeaNumworks
parent
ebf309654c
commit
c52ed0bf6d
@@ -6,6 +6,7 @@
|
||||
#include <escher/responder.h>
|
||||
#include <escher/message_text_view.h>
|
||||
#include <escher/invocation.h>
|
||||
#include <escher/palette.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user