summaryrefslogtreecommitdiff
path: root/plugingui/slider.h
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.h
parent65d72dde7fde9a48213bc1430f5c7be544b3ae28 (diff)
Make it possible to set the Slider colour via a public function.
Diffstat (limited to 'plugingui/slider.h')
-rw-r--r--plugingui/slider.h37
1 files changed, 23 insertions, 14 deletions
diff --git a/plugingui/slider.h b/plugingui/slider.h
index 7e4037f..9620fd0 100644
--- a/plugingui/slider.h
+++ b/plugingui/slider.h
@@ -53,6 +53,10 @@ public:
void setValue(float new_value);
float value() const;
+ enum class Colour { Green, Red, Blue };
+ // Changes the colour of the inner bar
+ void setColour(Colour colour);
+
Notifier<> clickNotifier;
protected:
@@ -73,31 +77,36 @@ private:
State state;
- TexturedBox bar{
- getImageCache(), ":slider.png", 0, 0, // atlas offset (x, y)
- 7, 1, 7, // dx1, dx2, dx3
- 7, 1, 7 // dy1, dy2, dy3
+ TexturedBox bar{getImageCache(), ":slider.png",
+ 0, 0, // atlas offset (x, y)
+ 7, 1, 7, // dx1, dx2, dx3
+ 7, 1, 7 // dy1, dy2, dy3
+ };
+ TexturedBox inner_bar_green{getImageCache(), ":slider.png",
+ 30, 0, // atlas offset (x, y)
+ 2, 1, 2, // dx1, dx2, dx3
+ 2, 1, 2 // dy1, dy2, dy3
+ };
+ TexturedBox inner_bar_red{getImageCache(), ":slider.png",
+ 30, 5, // atlas offset (x, y)
+ 2, 1, 2, // dx1, dx2, dx3
+ 2, 1, 2 // dy1, dy2, dy3
};
- // TexturedBox inner_bar_green{
- // getImageCache(), ":slider.png", 30, 0, // atlas offset (x, y)
- // 2, 1, 2, // dx1, dx2, dx3
- // 2, 1, 2 // dy1, dy2, dy3
- // };
- // TexturedBox inner_bar_red{getImageCache(), ":slider.png",
- // 30, 5, // atlas offset (x, y)
- // 2, 1, 2, // dx1, dx2, dx3
- // 2, 1, 2 // dy1, dy2, dy3
- // };
TexturedBox inner_bar_blue{getImageCache(), ":slider.png",
30, 10, // atlas offset (x, y)
2, 1, 2, // dx1, dx2, dx3
2, 1, 2 // dy1, dy2, dy3
};
+
Texture button{
getImageCache(), ":slider.png", 15, 0, // atlas offset (x, y)
15, 15 // width, height
};
+ // This points to the inner_bar_* of the current color.
+ // It should never be a nullptr!
+ TexturedBox* inner_bar{&inner_bar_blue};
+
std::size_t bar_boundary{5};
std::size_t button_offset{7};