blob: f21751478f7015e3538623b96773226ce7304948 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma once
#include "StarWidget.hpp"
#include "StarButtonWidget.hpp"
#include "StarImageWidget.hpp"
namespace Star {
// This class only does left right right now. If you need advanced
// multiorientation physics please
// implement it in.
class SliderBarWidget : public Widget {
public:
SliderBarWidget(String const& grid, bool showSpinner = true);
void setJogImages(String const& baseImage, String const& hoverImage = "", String const& pressedImage = "", String const& disabledImage = "");
void setRange(int low, int high, int delta);
void setRange(Vec2I const& range, int delta);
void setVal(int val, bool callbackIfChanged = true);
int val() const;
void setEnabled(bool enabled);
void setCallback(WidgetCallbackFunc callback);
virtual void update(float dt) override;
virtual bool sendEvent(InputEvent const& event) override;
private:
void leftCallback();
void rightCallback();
ButtonWidgetPtr m_leftButton;
ButtonWidgetPtr m_rightButton;
ImageWidgetPtr m_grid;
ButtonWidgetPtr m_jog;
int m_low;
int m_high;
int m_delta;
int m_val;
bool m_updateJog;
Vec2I m_savedJogPos;
Vec2I m_jogDragPos;
bool m_jogDragActive;
bool m_enabled;
WidgetCallbackFunc m_callback;
};
typedef shared_ptr<SliderBarWidget> SliderBarWidgetPtr;
}
|