Refactor editor windowing system layout
This commit is contained in:
41
editor/app/Windowing/System/EditorWindowWorkspaceStore.cpp
Normal file
41
editor/app/Windowing/System/EditorWindowWorkspaceStore.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "Windowing/System/EditorWindowWorkspaceStore.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
EditorWindowWorkspaceStore::EditorWindowWorkspaceStore(UIEditorPanelRegistry panelRegistry)
|
||||
: m_panelRegistry(std::move(panelRegistry)) {}
|
||||
|
||||
bool EditorWindowWorkspaceStore::ValidateWindowSet(
|
||||
const UIEditorWindowWorkspaceSet& windowSet,
|
||||
std::string& outError) const {
|
||||
const UIEditorWindowWorkspaceValidationResult validation =
|
||||
ValidateUIEditorWindowWorkspaceSet(m_panelRegistry, windowSet);
|
||||
if (!validation.IsValid()) {
|
||||
outError = validation.message;
|
||||
return false;
|
||||
}
|
||||
|
||||
outError.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorWindowWorkspaceStore::TrySetWindowSet(
|
||||
UIEditorWindowWorkspaceSet windowSet,
|
||||
std::string& outError) {
|
||||
if (!ValidateWindowSet(windowSet, outError)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_windowSet = std::move(windowSet);
|
||||
outError.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EditorWindowWorkspaceStore::IsPrimaryWindowId(std::string_view windowId) const {
|
||||
return !windowId.empty() && m_windowSet.primaryWindowId == windowId;
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
Reference in New Issue
Block a user