diff options
author | crupest <crupest@outlook.com> | 2020-07-05 19:48:49 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-07-05 19:48:49 +0800 |
commit | bbec59718bf8a824583869126762013112f8e568 (patch) | |
tree | 1c0917e7c12a7af9ff3482f452a9da684a74ed81 /include/cru/ui | |
parent | ce56ab59a6d68c220fcc47c6977c618eaa43de7a (diff) | |
download | cru-bbec59718bf8a824583869126762013112f8e568.tar.gz cru-bbec59718bf8a824583869126762013112f8e568.tar.bz2 cru-bbec59718bf8a824583869126762013112f8e568.zip |
...
Diffstat (limited to 'include/cru/ui')
-rw-r--r-- | include/cru/ui/Base.hpp | 4 | ||||
-rw-r--r-- | include/cru/ui/UiEvent.hpp | 5 | ||||
-rw-r--r-- | include/cru/ui/render/ScrollRenderObject.hpp | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/include/cru/ui/Base.hpp b/include/cru/ui/Base.hpp index c59d1b60..9036a47b 100644 --- a/include/cru/ui/Base.hpp +++ b/include/cru/ui/Base.hpp @@ -185,6 +185,10 @@ class Control; class ClickDetector; class UiHost; +namespace render { +class RenderObject; +} + //-------------------- region: basic types -------------------- namespace internal { constexpr int align_start = 0; diff --git a/include/cru/ui/UiEvent.hpp b/include/cru/ui/UiEvent.hpp index 79d0f7e3..39f26aee 100644 --- a/include/cru/ui/UiEvent.hpp +++ b/include/cru/ui/UiEvent.hpp @@ -13,10 +13,6 @@ namespace cru::platform::graph { struct IPainter; } -namespace cru::ui { -class Control; -} - namespace cru::ui::event { class UiEventArgs : public Object { public: @@ -88,6 +84,7 @@ class MouseEventArgs : public UiEventArgs { // This point is relative to window client lefttop. Point GetPoint() const { return point_.value_or(Point{}); } + Point GetPointToContent(render::RenderObject* render_target) const; private: std::optional<Point> point_; diff --git a/include/cru/ui/render/ScrollRenderObject.hpp b/include/cru/ui/render/ScrollRenderObject.hpp index 0c1fb16b..20b7278c 100644 --- a/include/cru/ui/render/ScrollRenderObject.hpp +++ b/include/cru/ui/render/ScrollRenderObject.hpp @@ -28,6 +28,9 @@ class ScrollRenderObject : public RenderObject { void SetScrollOffset(const Point& offset); Point GetRawScrollOffset() const { return scroll_offset_; } + // Rect lefttop relative to content rect. + void ScrollToContain(const Rect& rect); + protected: void OnDrawCore(platform::graph::IPainter* painter) override; |