| 90 | } |
| 91 | |
| 92 | ScrollBar::ScrollBar(GuiDirection direction, WidgetCallbackFunc forwardFunc, WidgetCallbackFunc backwardFunc) |
| 93 | : m_direction(direction) { |
| 94 | m_forward = make_shared<ButtonWidget>(); |
| 95 | m_forward->setCallback(forwardFunc); |
| 96 | m_forward->setSustainCallbackOnDownHold(true); |
| 97 | m_forward->setPressedOffset({0, 0}); |
| 98 | |
| 99 | m_backward = make_shared<ButtonWidget>(); |
| 100 | m_backward->setCallback(backwardFunc); |
| 101 | m_backward->setSustainCallbackOnDownHold(true); |
| 102 | m_backward->setPressedOffset({0, 0}); |
| 103 | |
| 104 | m_thumb = make_shared<ScrollThumb>(m_direction); |
| 105 | |
| 106 | auto assets = Root::singleton().assets(); |
| 107 | setButtonImages(assets->json("/interface.config:scrollArea.buttons")); |
| 108 | |
| 109 | addChild("thumb", m_thumb); |
| 110 | addChild("forward", m_forward); |
| 111 | addChild("backward", m_backward); |
| 112 | } |
| 113 | |
| 114 | void ScrollBar::setButtonImages(Json const& images) { |
| 115 | String directionString; |
nothing calls this directly
no test coverage detected