58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
#include "EditorWindowManager.h"
|
|
|
|
#include "EditorWindow.h"
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
EditorWindow* EditorWindowManager::FindWindow(HWND hwnd) {
|
|
if (hwnd == nullptr) {
|
|
return nullptr;
|
|
}
|
|
|
|
for (const std::unique_ptr<EditorWindow>& window : m_windows) {
|
|
if (window != nullptr && window->GetHwnd() == hwnd) {
|
|
return window.get();
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
const EditorWindow* EditorWindowManager::FindWindow(HWND hwnd) const {
|
|
return const_cast<EditorWindowManager*>(this)->FindWindow(hwnd);
|
|
}
|
|
|
|
EditorWindow* EditorWindowManager::FindWindow(std::string_view windowId) {
|
|
if (windowId.empty()) {
|
|
return nullptr;
|
|
}
|
|
|
|
for (const std::unique_ptr<EditorWindow>& window : m_windows) {
|
|
if (window != nullptr && window->GetWindowId() == windowId) {
|
|
return window.get();
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
const EditorWindow* EditorWindowManager::FindWindow(std::string_view windowId) const {
|
|
return const_cast<EditorWindowManager*>(this)->FindWindow(windowId);
|
|
}
|
|
|
|
EditorWindow* EditorWindowManager::FindPrimaryWindow() {
|
|
for (const std::unique_ptr<EditorWindow>& window : m_windows) {
|
|
if (window != nullptr && window->IsPrimary()) {
|
|
return window.get();
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
const EditorWindow* EditorWindowManager::FindPrimaryWindow() const {
|
|
return const_cast<EditorWindowManager*>(this)->FindPrimaryWindow();
|
|
}
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|