summaryrefslogtreecommitdiff
path: root/plugingui/button.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.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.cc')
-rw-r--r--plugingui/button.cc31
1 files changed, 19 insertions, 12 deletions
diff --git a/plugingui/button.cc b/plugingui/button.cc
index 0da79a0..4cd3ef3 100644
--- a/plugingui/button.cc
+++ b/plugingui/button.cc
@@ -59,24 +59,31 @@ void Button::repaintEvent(RepaintEvent* repaintEvent)
return;
}
- switch(draw_state)
- {
- case State::Up:
- box_up.setSize(w - padLeft, h - padTop);
- p.drawImage(padLeft, padTop, box_up);
- break;
+ if (enabled) {
+ switch(draw_state)
+ {
+ case State::Up:
+ box_up.setSize(w - padLeft, h - padTop);
+ p.drawImage(padLeft, padTop, box_up);
+ break;
+
+ case State::Down:
+ box_down.setSize(w - padLeft, h - padTop);
+ p.drawImage(padLeft, padTop, box_down);
+ break;
+ }
+ }
+ else {
+ box_grey.setSize(w - padLeft, h - padTop);
+ p.drawImage(padLeft, padTop, box_grey);
- case State::Down:
- box_down.setSize(w - padLeft, h - padTop);
- p.drawImage(padLeft, padTop, box_down);
- break;
+ p.setColour(Colour(0.3));
}
- p.setColour(Colour(0.1));
auto x = (w / 2) - (3 * text.length()) + (draw_state == State::Up ? 0 : 1) +
(padLeft / 2);
auto y = (h / 2) + 5 + 1 + (draw_state == State::Up ? 0 : 1) + (padTop / 2);
- p.drawText(x, y, font, text, true);
+ p.drawText(x, y, font, text, enabled);
}
} // GUI::