aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/render
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-07-08 17:14:42 +0800
committercrupest <crupest@outlook.com>2020-07-08 17:14:42 +0800
commit83736f1208a613d2457147c2df3f493228bab3cb (patch)
tree5bd44c7d1676c040f4cd61b9862a418d5b8ba29c /include/cru/ui/render
parent3a49e87637e2493f3e5854bbcb8ab804bae5a46e (diff)
downloadcru-83736f1208a613d2457147c2df3f493228bab3cb.tar.gz
cru-83736f1208a613d2457147c2df3f493228bab3cb.tar.bz2
cru-83736f1208a613d2457147c2df3f493228bab3cb.zip
...
Diffstat (limited to 'include/cru/ui/render')
-rw-r--r--include/cru/ui/render/ScrollRenderObject.hpp2
-rw-r--r--include/cru/ui/render/TextRenderObject.hpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/include/cru/ui/render/ScrollRenderObject.hpp b/include/cru/ui/render/ScrollRenderObject.hpp
index 20b7278c..45fa3993 100644
--- a/include/cru/ui/render/ScrollRenderObject.hpp
+++ b/include/cru/ui/render/ScrollRenderObject.hpp
@@ -29,7 +29,7 @@ class ScrollRenderObject : public RenderObject {
Point GetRawScrollOffset() const { return scroll_offset_; }
// Rect lefttop relative to content rect.
- void ScrollToContain(const Rect& rect);
+ void ScrollToContain(const Rect& rect, const Thickness& margin = Thickness{});
protected:
void OnDrawCore(platform::graph::IPainter* painter) override;
diff --git a/include/cru/ui/render/TextRenderObject.hpp b/include/cru/ui/render/TextRenderObject.hpp
index 32d96797..0b276415 100644
--- a/include/cru/ui/render/TextRenderObject.hpp
+++ b/include/cru/ui/render/TextRenderObject.hpp
@@ -66,6 +66,11 @@ class TextRenderObject : public RenderObject {
gsl::index GetCaretPosition() const { return caret_position_; }
void SetCaretPosition(gsl::index position);
+ // Lefttop relative to content lefttop.
+ Rect GetCaretRectInContent();
+ // Lefttop relative to render object lefttop.
+ Rect GetCaretRect();
+
std::shared_ptr<platform::graph::IBrush> GetCaretBrush() const {
return caret_brush_;
}