make scrollbar interactive

This commit is contained in:
MihailRis
2024-12-05 14:43:24 +03:00
parent bad2b44c96
commit b65ba61f9a
6 changed files with 65 additions and 16 deletions
+9
View File
@@ -7,13 +7,19 @@
namespace gui {
class Container : public UINode {
int prevScrollY = -1;
protected:
std::vector<std::shared_ptr<UINode>> nodes;
std::vector<IntervalEvent> intervalEvents;
int scroll = 0;
int scrollStep = 40;
int scrollBarWidth = 10;
int actualLength = 0;
bool scrollable = true;
bool isScrolling() {
return prevScrollY != -1;
}
public:
Container(glm::vec2 size);
virtual ~Container();
@@ -36,6 +42,9 @@ namespace gui {
virtual void setScrollStep(int step);
virtual void refresh() override;
virtual void mouseMove(GUI*, int x, int y) override;
virtual void mouseRelease(GUI*, int x, int y) override;
const std::vector<std::shared_ptr<UINode>>& getNodes() const;
};
}