diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 19:19:00 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-20 19:19:00 +0200 |
commit | 89b3bde1cfeb9fa3c7097555a86c6436da848a97 (patch) | |
tree | 4e69ab33bcf3699fc28d358933ccda0d6cc70b73 /plugingui/button_base.cc | |
parent | c15331fa4b98ba58b2b500c79088d43ed31a4b4e (diff) |
Gray out diskstreaming "Apply" button if the value didn't change.
Also add a new texture for that.
Diffstat (limited to 'plugingui/button_base.cc')
-rw-r--r-- | plugingui/button_base.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/plugingui/button_base.cc b/plugingui/button_base.cc index 1030bbc..bf441f5 100644 --- a/plugingui/button_base.cc +++ b/plugingui/button_base.cc @@ -42,7 +42,7 @@ ButtonBase::~ButtonBase() void ButtonBase::buttonEvent(ButtonEvent* buttonEvent) { // Ignore everything except left clicks. - if(buttonEvent->button != MouseButton::left) + if(!enabled || buttonEvent->button != MouseButton::left) { return; } @@ -74,8 +74,23 @@ void ButtonBase::setText(const std::string& text) redraw(); } +void ButtonBase::setEnabled(bool enabled) +{ + this->enabled = enabled; + redraw(); +} + +bool ButtonBase::isEnabled() const +{ + return enabled; +} + void ButtonBase::mouseLeaveEvent() { + if (!enabled) { + return; + } + in_button = false; if(button_state == State::Down) { @@ -86,6 +101,10 @@ void ButtonBase::mouseLeaveEvent() void ButtonBase::mouseEnterEvent() { + if (!enabled) { + return; + } + in_button = true; if(button_state == State::Down) { |