diff options
author | crupest <crupest@outlook.com> | 2020-06-28 00:17:50 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-28 00:17:50 +0800 |
commit | 2ef55b1fdbbe6f13ab835e20021b9ae53322d75e (patch) | |
tree | fb25d95530c3b3a193a3337a835a206c07f32885 /include | |
parent | b5e5dc788b400fc5d9190d2d5e6bc5f0f6755511 (diff) | |
download | cru-2ef55b1fdbbe6f13ab835e20021b9ae53322d75e.tar.gz cru-2ef55b1fdbbe6f13ab835e20021b9ae53322d75e.tar.bz2 cru-2ef55b1fdbbe6f13ab835e20021b9ae53322d75e.zip |
...
Diffstat (limited to 'include')
-rw-r--r-- | include/cru/ui/controls/FlexLayout.hpp | 2 | ||||
-rw-r--r-- | include/cru/ui/render/LayoutRenderObject.hpp | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/include/cru/ui/controls/FlexLayout.hpp b/include/cru/ui/controls/FlexLayout.hpp index beacd1f9..3d6087c2 100644 --- a/include/cru/ui/controls/FlexLayout.hpp +++ b/include/cru/ui/controls/FlexLayout.hpp @@ -29,7 +29,7 @@ class FlexLayout : public LayoutControl { void SetFlexDirection(FlexDirection direction); FlexChildLayoutData GetChildLayoutData(Control* control); - void SetChildLayoutData(Control* control, const FlexChildLayoutData& data); + void SetChildLayoutData(Control* control, FlexChildLayoutData data); protected: void OnAddChild(Control* child, Index position) override; diff --git a/include/cru/ui/render/LayoutRenderObject.hpp b/include/cru/ui/render/LayoutRenderObject.hpp index f99eb4ca..1eb9a816 100644 --- a/include/cru/ui/render/LayoutRenderObject.hpp +++ b/include/cru/ui/render/LayoutRenderObject.hpp @@ -22,10 +22,17 @@ class LayoutRenderObject : public RenderObject { return this->child_layout_data_; } - ChildLayoutData* GetChildLayoutData(Index position) { + void SetChildLayoutData(Index position, ChildLayoutData data) { Expects(position >= 0 && - position < static_cast<Index>(child_layout_data_.size())); - return &child_layout_data_[position]; + position < static_cast<Index>(this->child_layout_data_.size())); + this->child_layout_data_[position] = std::move(data); + this->InvalidateLayout(); + } + + const ChildLayoutData& GetChildLayoutData(Index position) const { + Expects(position >= 0 && + position < static_cast<Index>(this->child_layout_data_.size())); + return this->child_layout_data_[position]; } void Draw(platform::graph::IPainter* painter) override; |