Window resizing works

This commit is contained in:
Dynamitos
2023-11-18 11:04:30 +01:00
parent ec760e8deb
commit 6daaa61641
12 changed files with 92 additions and 50 deletions
+13
View File
@@ -8,6 +8,7 @@ Window::Window(PWindowManager owner, Gfx::OWindow handle)
: owner(owner)
, gfxHandle(std::move(handle))
{
gfxHandle->setResizeCallback([this](uint32 w, uint32 h) {onResize(w, h); });
}
Window::~Window()
@@ -57,3 +58,15 @@ void Window::setFocused(PView view)
owner->notifyWindowClosed(this);
});
}
void Window::onResize(uint32 width, uint32 height)
{
for (auto& view : views)
{
// TODO: some sort of layouting algorithm should do this
view->applyArea(URect{
.size = UVector2(width, height),
.offset = UVector2(0, 0),
});
}
}