blob: 5a31b92ff29b8e9db4ef352bc2091af8c7b8bcec (
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
|
#pragma once
#include "Widget.hpp"
#include "../SafeVector.hpp"
#include <memory>
namespace gsr {
class ScrollablePage : public Widget {
public:
ScrollablePage(mgl::vec2f size);
ScrollablePage(const ScrollablePage&) = delete;
ScrollablePage& operator=(const ScrollablePage&) = delete;
bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override;
void draw(mgl::Window &window, mgl::vec2f offset) override;
mgl::vec2f get_size() override;
void set_size(mgl::vec2f size);
void add_widget(std::unique_ptr<Widget> widget);
void reset_scroll();
private:
mgl::vec2f size;
SafeVector<std::unique_ptr<Widget>> widgets;
int scroll_target_y = 0;
double scroll_y = 0.0;
};
}
|