diff options
author | crupest <crupest@outlook.com> | 2018-09-22 22:57:44 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-22 22:57:44 +0800 |
commit | 5d91d1e5594e37ca5c282e602407eaeb34c6d986 (patch) | |
tree | 0086bb88c152b8ea9eb31e86906afcd238309cda /CruUI/ui/controls/linear_layout.h | |
parent | dc293cef8f25ba70c5d99d73aa472277484ca879 (diff) | |
download | cru-5d91d1e5594e37ca5c282e602407eaeb34c6d986.tar.gz cru-5d91d1e5594e37ca5c282e602407eaeb34c6d986.tar.bz2 cru-5d91d1e5594e37ca5c282e602407eaeb34c6d986.zip |
Done 3 things:
1. Add some helper functions for create controls with layout params.
2. Fix a bug in measure of linear layout.
3. Fix a bug in exception.
Diffstat (limited to 'CruUI/ui/controls/linear_layout.h')
-rw-r--r-- | CruUI/ui/controls/linear_layout.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/CruUI/ui/controls/linear_layout.h b/CruUI/ui/controls/linear_layout.h index ead56081..369824d4 100644 --- a/CruUI/ui/controls/linear_layout.h +++ b/CruUI/ui/controls/linear_layout.h @@ -13,9 +13,12 @@ namespace cru::ui::controls Vertical }; - static LinearLayout* Create(const Orientation orientation = Orientation::Vertical) + static LinearLayout* Create(const Orientation orientation = Orientation::Vertical, const std::initializer_list<Control*>& children = std::initializer_list<Control*>()) { - return new LinearLayout(orientation); + const auto linear_layout = new LinearLayout(orientation); + for (const auto control : children) + linear_layout->AddChild(control); + return linear_layout; } protected: |