diff options
author | 杨宇千 <crupest@outlook.com> | 2019-09-17 16:05:17 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-09-17 16:05:17 +0800 |
commit | e8dd10eec26d26c3fb30f2712ccf58ac72edc8a2 (patch) | |
tree | 75293a2bb477fb1872087fab8bfd2c89b6d2051f /include/cru/ui/render/flex_layout_render_object.hpp | |
parent | 465d89b4207cce929dc8e0b6ac93c3533ba19408 (diff) | |
download | cru-e8dd10eec26d26c3fb30f2712ccf58ac72edc8a2.tar.gz cru-e8dd10eec26d26c3fb30f2712ccf58ac72edc8a2.tar.bz2 cru-e8dd10eec26d26c3fb30f2712ccf58ac72edc8a2.zip |
...
Diffstat (limited to 'include/cru/ui/render/flex_layout_render_object.hpp')
-rw-r--r-- | include/cru/ui/render/flex_layout_render_object.hpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/include/cru/ui/render/flex_layout_render_object.hpp b/include/cru/ui/render/flex_layout_render_object.hpp index 68ffc89e..7b71b96e 100644 --- a/include/cru/ui/render/flex_layout_render_object.hpp +++ b/include/cru/ui/render/flex_layout_render_object.hpp @@ -15,7 +15,7 @@ namespace internal { constexpr int align_start = 0; constexpr int align_end = align_start + 1; constexpr int align_center = align_end + 1; -//constexpr int align_stretch = align_center + 1; +// constexpr int align_stretch = align_center + 1; } // namespace internal enum class FlexMainAlignment { @@ -27,7 +27,7 @@ enum class FlexCrossAlignment { Start = internal::align_start, End = internal::align_end, Center = internal::align_center, -// Stretch = internal::align_stretch + // Stretch = internal::align_stretch }; struct FlexChildLayoutData { @@ -50,19 +50,33 @@ class FlexLayoutRenderObject : public RenderObject { ~FlexLayoutRenderObject() override = default; FlexDirection GetFlexDirection() const { return direction_; } - void SetFlexDirection(FlexDirection direction) { direction_ = direction; } + void SetFlexDirection(FlexDirection direction) { + direction_ = direction; + InvalidateLayout(); + } FlexMainAlignment GetContentMainAlign() const { return content_main_align_; } void SetContentMainAlign(FlexMainAlignment align) { content_main_align_ = align; + InvalidateLayout(); } FlexCrossAlignment GetItemCrossAlign() const { return item_cross_align_; } void SetItemCrossAlign(FlexCrossAlignment align) { item_cross_align_ = align; + InvalidateLayout(); + } + + FlexChildLayoutData GetChildLayoutData(int position) { + assert(position >= 0 && position < child_layout_data_.size()); + return child_layout_data_[position]; } - FlexChildLayoutData* GetChildLayoutData(int position); + void SetChildLayoutData(int position, const FlexChildLayoutData& data) { + assert(position >= 0 && position < child_layout_data_.size()); + child_layout_data_[position] = data; + InvalidateLayout(); + } void Draw(platform::graph::Painter* painter) override; |