| 1 | //============================================================================ |
| 2 | // |
| 3 | // SSSS tt lll lll |
| 4 | // SS SS tt ll ll |
| 5 | // SS tttttt eeee ll ll aaaa |
| 6 | // SSSS tt ee ee ll ll aa |
| 7 | // SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" |
| 8 | // SS SS tt ee ll ll aa aa |
| 9 | // SSSS ttt eeeee llll llll aaaaa |
| 10 | // |
| 11 | // Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony |
| 12 | // and the Stella Team |
| 13 | // |
| 14 | // See the file "License.txt" for information on usage and redistribution of |
| 15 | // this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 16 | //============================================================================ |
| 17 | |
| 18 | #ifndef TIMELINE_WIDGET_HXX |
| 19 | #define TIMELINE_WIDGET_HXX |
| 20 | |
| 21 | #include "Widget.hxx" |
| 22 | |
| 23 | class TimeLineWidget : public ButtonWidget |
| 24 | { |
| 25 | public: |
| 26 | TimeLineWidget(GuiObject* boss, const GUI::Font& font, |
| 27 | int x, int y, int w, int h, const string& label = "" , |
| 28 | uInt32 labelWidth = 0, int cmd = 0); |
| 29 | |
| 30 | void setValue(uInt32 value); |
| 31 | uInt32 getValue() const { return _value; } |
| 32 | |
| 33 | void setMinValue(uInt32 value); |
| 34 | void setMaxValue(uInt32 value); |
| 35 | uInt32 getMinValue() const { return _valueMin; } |
| 36 | uInt32 getMaxValue() const { return _valueMax; } |
| 37 | |
| 38 | /** |
| 39 | Steps are not necessarily linear in a timeline, so we need info |
| 40 | on each interval instead. |
| 41 | */ |
| 42 | void setStepValues(const IntArray& steps); |
| 43 | |
| 44 | protected: |
| 45 | void handleMouseMoved(int x, int y) override; |
| 46 | void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; |
| 47 | void handleMouseUp(int x, int y, MouseButton b, int clickCount) override; |
| 48 | void handleMouseWheel(int x, int y, int direction) override; |
| 49 | |
| 50 | void drawWidget(bool hilite) override; |
| 51 | |
| 52 | uInt32 valueToPos(uInt32 value); |
| 53 | uInt32 posToValue(uInt32 pos); |
| 54 | |
| 55 | protected: |
| 56 | uInt32 _value; |
| 57 | uInt32 _valueMin, _valueMax; |
| 58 | bool _isDragging; |
| 59 | uInt32 _labelWidth; |
| 60 | |
| 61 | uIntArray _stepValue; |
| 62 | |
| 63 | private: |
| 64 | // Following constructors and assignment operators not supported |
| 65 | TimeLineWidget() = delete; |
| 66 | TimeLineWidget(const TimeLineWidget&) = delete; |
| 67 | TimeLineWidget(TimeLineWidget&&) = delete; |
| 68 | TimeLineWidget& operator=(const TimeLineWidget&) = delete; |
| 69 | TimeLineWidget& operator=(TimeLineWidget&&) = delete; |
| 70 | }; |
| 71 | |
| 72 | #endif |
| 73 | |