summaryrefslogtreecommitdiff
path: root/plugingui/slider.cc
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2017-04-17 09:30:52 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2017-04-17 09:30:52 +0200
commit7d58f10c8034b779d752028ec3b5dcbce848c661 (patch)
tree6478dfcb13516eb0ab69520e1937305698561c66 /plugingui/slider.cc
parent65d72dde7fde9a48213bc1430f5c7be544b3ae28 (diff)
Make it possible to set the Slider colour via a public function.
Diffstat (limited to 'plugingui/slider.cc')
-rw-r--r--plugingui/slider.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/plugingui/slider.cc b/plugingui/slider.cc
index 19343bc..6a764b8 100644
--- a/plugingui/slider.cc
+++ b/plugingui/slider.cc
@@ -55,6 +55,21 @@ float Slider::value() const
return current_value;
}
+void Slider::setColour(Colour colour)
+{
+ switch (colour) {
+ case Colour::Green:
+ inner_bar = &inner_bar_green;
+ break;
+ case Colour::Red:
+ inner_bar = &inner_bar_red;
+ break;
+ case Colour::Blue:
+ inner_bar = &inner_bar_blue;
+ break;
+ }
+}
+
void Slider::repaintEvent(RepaintEvent* repaintEvent)
{
Painter p(*this);
@@ -69,9 +84,8 @@ void Slider::repaintEvent(RepaintEvent* repaintEvent)
p.drawImage(0, 0, bar);
// draw inner bar
- inner_bar_blue.setSize(
- button_x - bar_boundary, height() - 2 * bar_boundary);
- p.drawImage(bar_boundary, bar_boundary, inner_bar_blue);
+ inner_bar->setSize(button_x - bar_boundary, height() - 2 * bar_boundary);
+ p.drawImage(bar_boundary, bar_boundary, *inner_bar);
// draw button
p.drawImage(button_x, button_y, button);