aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-05-11 16:51:52 +0800
committercrupest <crupest@outlook.com>2021-05-11 16:51:52 +0800
commitf54032b94817bc5a03be68d39758e9b3d67a1b59 (patch)
tree4c40cf74302678a07873adab4d5d5ad6348b403b /include/cru/ui
parent5c050b44558856ad0fe41dab95f97ea0a59d77eb (diff)
downloadcru-f54032b94817bc5a03be68d39758e9b3d67a1b59.tar.gz
cru-f54032b94817bc5a03be68d39758e9b3d67a1b59.tar.bz2
cru-f54032b94817bc5a03be68d39758e9b3d67a1b59.zip
...
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/render/ScrollRenderObject.hpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/cru/ui/render/ScrollRenderObject.hpp b/include/cru/ui/render/ScrollRenderObject.hpp
index 7b98ab72..099c8cb5 100644
--- a/include/cru/ui/render/ScrollRenderObject.hpp
+++ b/include/cru/ui/render/ScrollRenderObject.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "RenderObject.hpp"
+#include "cru/common/Event.hpp"
#include "cru/platform/graphics/util/Painter.hpp"
#include "cru/ui/Base.hpp"
#include "cru/ui/render/ScrollBar.hpp"
@@ -44,7 +45,7 @@ class ScrollRenderObject : public RenderObject {
}
}
- void Scroll(const Scroll& scroll);
+ void ApplyScroll(const Scroll& scroll);
Point GetRawScrollOffset() const { return scroll_offset_; }
@@ -62,6 +63,14 @@ class ScrollRenderObject : public RenderObject {
std::u16string_view GetName() const override { return u"ScrollRenderObject"; }
+ bool IsMouseWheelScrollEnabled() const { return is_mouse_wheel_enabled_; }
+ void SetMouseWheelScrollEnabled(bool enable);
+
+ bool HorizontalCanScrollUp();
+ bool HorizontalCanScrollDown();
+ bool VerticalCanScrollUp();
+ bool VerticalCanScrollDown();
+
protected:
void OnDrawCore(platform::graphics::IPainter* painter) override;
@@ -75,9 +84,15 @@ class ScrollRenderObject : public RenderObject {
void OnAttachedControlChanged(controls::Control* control) override;
+ void InstallMouseWheelHandler(controls::Control* control);
+
private:
Point scroll_offset_;
std::unique_ptr<ScrollBarDelegate> scroll_bar_delegate_;
+
+ bool is_mouse_wheel_enabled_ = true;
+
+ EventRevokerListGuard guard_;
};
} // namespace cru::ui::render