aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui/render/LayoutRenderObject.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-09 23:53:18 +0800
committercrupest <crupest@outlook.com>2022-02-09 23:53:18 +0800
commitb8863c403a44c1c7ac35f1a1da92bbf3c8858552 (patch)
tree7e38f029f0657e6c1210a53f1cba331cdb8feab6 /include/cru/ui/render/LayoutRenderObject.h
parentd18b5453d7ffd19667ee8ac125b34ab5328f0dc3 (diff)
downloadcru-b8863c403a44c1c7ac35f1a1da92bbf3c8858552.tar.gz
cru-b8863c403a44c1c7ac35f1a1da92bbf3c8858552.tar.bz2
cru-b8863c403a44c1c7ac35f1a1da92bbf3c8858552.zip
...
Diffstat (limited to 'include/cru/ui/render/LayoutRenderObject.h')
-rw-r--r--include/cru/ui/render/LayoutRenderObject.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/cru/ui/render/LayoutRenderObject.h b/include/cru/ui/render/LayoutRenderObject.h
index 62ee9005..d6882f9a 100644
--- a/include/cru/ui/render/LayoutRenderObject.h
+++ b/include/cru/ui/render/LayoutRenderObject.h
@@ -11,7 +11,7 @@ class CRU_UI_API LayoutRenderObject : public RenderObject {
private:
struct ChildData {
- RenderObject* child;
+ RenderObject* render_object;
ChildLayoutData layout_data;
};
@@ -43,19 +43,19 @@ class CRU_UI_API LayoutRenderObject : public RenderObject {
children_.erase(children_.begin() + position);
}
- void SetChildLayoutData(Index position, ChildLayoutData data) {
+ const ChildLayoutData& GetChildLayoutDataAt(Index position) const {
Expects(position >= 0 && position < GetChildCount());
- children_[position].layout_data = std::move(data);
- InvalidateLayout();
+ return children_[position].layout_data;
}
- const ChildLayoutData& GetChildLayoutData(Index position) const {
+ void SetChildLayoutDataAt(Index position, ChildLayoutData data) {
Expects(position >= 0 && position < GetChildCount());
- return children_[position].layout_data;
+ children_[position].layout_data = std::move(data);
+ InvalidateLayout();
}
void Draw(platform::graphics::IPainter* painter) override {
- for (auto& child : children_) {
+ for (const auto& child : children_) {
painter->PushState();
painter->ConcatTransform(
Matrix::Translation(child.render_object->GetOffset()));