refactor(new_editor/app): split window manager and editor context hotspots
This commit is contained in:
57
new_editor/app/Platform/Win32/EditorWindowManagerLookup.cpp
Normal file
57
new_editor/app/Platform/Win32/EditorWindowManagerLookup.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user