From 55d98d3259e9f3e184ad6323d1d49d298bd1723b Mon Sep 17 00:00:00 2001 From: 杨宇千 Date: Sun, 15 Sep 2019 00:22:59 +0800 Subject: ... --- include/cru/ui/controls/flex_layout.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/cru/ui/controls') diff --git a/include/cru/ui/controls/flex_layout.hpp b/include/cru/ui/controls/flex_layout.hpp index 46c4ea55..128a79b0 100644 --- a/include/cru/ui/controls/flex_layout.hpp +++ b/include/cru/ui/controls/flex_layout.hpp @@ -42,9 +42,22 @@ class FlexLayout : public LayoutControl { void SetContentMainAlign(FlexMainAlignment value) { if (value == GetContentMainAlign()) return; render_object_->SetContentMainAlign(value); - GetWindow()->InvalidateLayout(); + if (const auto window = GetWindow()) window->InvalidateLayout(); } + FlexDirection GetFlexDirection() const { + return render_object_->GetFlexDirection(); + } + + void SetFlexDirection(FlexDirection direction) { + if (direction == GetFlexDirection()) return; + render_object_->SetFlexDirection(direction); + if (const auto window = GetWindow()) window->InvalidateLayout(); + } + + FlexChildLayoutData GetChildLayoutData(Control* control); + void SetChildLayoutData(Control* control, const FlexChildLayoutData& data); + protected: void OnAddChild(Control* child, int position) override; void OnRemoveChild(Control* child, int position) override; -- cgit v1.2.3