From 5d91d1e5594e37ca5c282e602407eaeb34c6d986 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 22 Sep 2018 22:57:44 +0800 Subject: 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. --- CruUI/ui/controls/button.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'CruUI/ui/controls/button.h') diff --git a/CruUI/ui/controls/button.h b/CruUI/ui/controls/button.h index f9ad7726..bd3f6eb3 100644 --- a/CruUI/ui/controls/button.h +++ b/CruUI/ui/controls/button.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "ui/control.h" namespace cru::ui::controls @@ -7,9 +9,12 @@ namespace cru::ui::controls class Button : public Control { public: - static Button* Create() + static Button* Create(const std::initializer_list& children = std::initializer_list()) { - return new Button(); + const auto button = new Button(); + for (const auto control : children) + button->AddChild(control); + return button; } protected: -- cgit v1.2.3