summaryrefslogtreecommitdiff
path: root/plugingui/button_base.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-04-20 19:19:00 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-04-20 19:19:00 +0200
commit89b3bde1cfeb9fa3c7097555a86c6436da848a97 (patch)
tree4e69ab33bcf3699fc28d358933ccda0d6cc70b73 /plugingui/button_base.cc
parentc15331fa4b98ba58b2b500c79088d43ed31a4b4e (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.cc21
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)
{