aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-29 22:09:29 +0800
committercrupest <crupest@outlook.com>2022-01-29 22:09:29 +0800
commit592f3f3f25f00232234399f4c5f51318a3fa49d2 (patch)
tree9ff928062aab8598bbbd00aa243d234e80aa6406 /src/ui/controls
parenta2c2089c8d97b4910d4287c14c82e20d33366c24 (diff)
downloadcru-592f3f3f25f00232234399f4c5f51318a3fa49d2.tar.gz
cru-592f3f3f25f00232234399f4c5f51318a3fa49d2.tar.bz2
cru-592f3f3f25f00232234399f4c5f51318a3fa49d2.zip
...
Diffstat (limited to 'src/ui/controls')
-rw-r--r--src/ui/controls/RootControl.cpp3
-rw-r--r--src/ui/controls/StackLayout.cpp9
2 files changed, 12 insertions, 0 deletions
diff --git a/src/ui/controls/RootControl.cpp b/src/ui/controls/RootControl.cpp
index 7edf4a1d..a7366155 100644
--- a/src/ui/controls/RootControl.cpp
+++ b/src/ui/controls/RootControl.cpp
@@ -3,6 +3,7 @@
#include "cru/common/Base.hpp"
#include "cru/platform/gui/Base.hpp"
#include "cru/platform/gui/Window.hpp"
+#include "cru/ui/Base.hpp"
#include "cru/ui/host/WindowHost.hpp"
#include "cru/ui/render/Base.hpp"
#include "cru/ui/render/StackLayoutRenderObject.hpp"
@@ -15,6 +16,8 @@ RootControl::RootControl(Control* attached_control)
: attached_control_(attached_control) {
render_object_ = std::make_unique<render::StackLayoutRenderObject>();
render_object_->SetAttachedControl(this);
+ render_object_->SetDefaultHorizontalAlignment(Alignment::Stretch);
+ render_object_->SetDefaultVertialAlignment(Alignment::Stretch);
SetContainerRenderObject(render_object_.get());
window_host_ = std::make_unique<host::WindowHost>(this);
}
diff --git a/src/ui/controls/StackLayout.cpp b/src/ui/controls/StackLayout.cpp
index 89968571..667e6755 100644
--- a/src/ui/controls/StackLayout.cpp
+++ b/src/ui/controls/StackLayout.cpp
@@ -17,4 +17,13 @@ StackLayout::~StackLayout() = default;
render::RenderObject* StackLayout::GetRenderObject() const {
return render_object_.get();
}
+
+const StackChildLayoutData& StackLayout::GetChildLayoutData(Index position) {
+ return render_object_->GetChildLayoutData(position);
+}
+
+void StackLayout::SetChildLayoutData(Index position,
+ StackChildLayoutData data) {
+ render_object_->SetChildLayoutData(position, std::move(data));
+}
} // namespace cru::ui::controls