diff options
Diffstat (limited to 'src/ui/window.cpp')
-rw-r--r-- | src/ui/window.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp index 349b78ff..f7506f18 100644 --- a/src/ui/window.cpp +++ b/src/ui/window.cpp @@ -113,13 +113,23 @@ namespace cru::ui } } - Window::Window() : Control(WindowConstructorTag{}, this), control_list_({ this }) { + Window::Window() : Window(nullptr) + { + + } + + Window::Window(Window* parent) : Control(WindowConstructorTag{}, this), control_list_({ this }) { + + if (parent != nullptr && !parent->IsWindowValid()) + throw std::runtime_error("Parent window is not valid."); + const auto window_manager = WindowManager::GetInstance(); hwnd_ = CreateWindowEx(0, window_manager->GetGeneralWindowClass()->GetName(), L"", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - nullptr, nullptr, Application::GetInstance()->GetInstanceHandle(), nullptr + parent == nullptr ? nullptr : parent->GetWindowHandle(), + nullptr, Application::GetInstance()->GetInstanceHandle(), nullptr ); if (hwnd_ == nullptr) |