aboutsummaryrefslogtreecommitdiff
path: root/include/gui/ScrollablePage.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-11 00:54:57 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-11 00:54:57 +0200
commitdd906c6a9dde666af0b10cc016039f312733201f (patch)
treea18fea76ed728067cafba65d833234d92c2afcd3 /include/gui/ScrollablePage.hpp
parent747344b858c4750e7b0b19ca10c3727148c2a161 (diff)
Make scrollbar movable with mouse, limit filechooser content to inside of file item
Diffstat (limited to 'include/gui/ScrollablePage.hpp')
-rw-r--r--include/gui/ScrollablePage.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/gui/ScrollablePage.hpp b/include/gui/ScrollablePage.hpp
index 5a31b92..ade7c67 100644
--- a/include/gui/ScrollablePage.hpp
+++ b/include/gui/ScrollablePage.hpp
@@ -4,6 +4,8 @@
#include "../SafeVector.hpp"
#include <memory>
+#include <mglpp/system/FloatRect.hpp>
+
namespace gsr {
class ScrollablePage : public Widget {
public:
@@ -15,15 +17,22 @@ namespace gsr {
void draw(mgl::Window &window, mgl::vec2f offset) override;
mgl::vec2f get_size() override;
+ mgl::vec2f get_inner_size() override;
void set_size(mgl::vec2f size);
void add_widget(std::unique_ptr<Widget> widget);
void reset_scroll();
private:
+ float get_scrollbar_width() const;
+ private:
mgl::vec2f size;
SafeVector<std::unique_ptr<Widget>> widgets;
int scroll_target_y = 0;
double scroll_y = 0.0;
+ mgl::FloatRect scrollbar_rect;
+ bool moving_scrollbar_with_cursor = false;
+ mgl::vec2f scrollbar_move_cursor_start_pos;
+ double scrollbar_move_cursor_scroll_y_start = 0.0;
};
} \ No newline at end of file