diff options
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; |