aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/linear_layout.cpp
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2018-11-11 16:57:15 +0800
committerGitHub <noreply@github.com>2018-11-11 16:57:15 +0800
commit3cc588ade5ac08e53c406cea6bfcaaafac4346cf (patch)
tree0b3f9f274977c3f1561df58b80d3d0865a586a59 /src/ui/controls/linear_layout.cpp
parentb0e39c622fb94bd399812fd3368fd4197029a878 (diff)
parent14394d9a86ebf947176b0c4d850692b760d5980f (diff)
downloadcru-3cc588ade5ac08e53c406cea6bfcaaafac4346cf.tar.gz
cru-3cc588ade5ac08e53c406cea6bfcaaafac4346cf.tar.bz2
cru-3cc588ade5ac08e53c406cea6bfcaaafac4346cf.zip
Merge pull request #13 from crupest/12-layout
Fix issue 12 layout problem.
Diffstat (limited to 'src/ui/controls/linear_layout.cpp')
-rw-r--r--src/ui/controls/linear_layout.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ui/controls/linear_layout.cpp b/src/ui/controls/linear_layout.cpp
index f21a9933..3789b305 100644
--- a/src/ui/controls/linear_layout.cpp
+++ b/src/ui/controls/linear_layout.cpp
@@ -89,9 +89,28 @@ namespace cru::ui::controls
}
if (orientation_ == Orientation::Horizontal)
+ {
+ for (auto control : GetChildren())
+ {
+ if (control->GetLayoutParams()->height.mode == MeasureMode::Stretch)
+ {
+ control->SetDesiredSize(Size(control->GetDesiredSize().width, secondary_side_child_max_length));
+ }
+ }
actual_size_for_children.height = secondary_side_child_max_length;
+ }
else
+ {
+ for (auto control : GetChildren())
+ {
+ if (control->GetLayoutParams()->width.mode == MeasureMode::Stretch)
+ {
+ control->SetDesiredSize(Size(secondary_side_child_max_length, control->GetDesiredSize().height));
+ }
+ }
+
actual_size_for_children.width = secondary_side_child_max_length;
+ }
return actual_size_for_children;
}