Refine editor window architecture

This commit is contained in:
2026-04-25 17:51:37 +08:00
parent ef41c44464
commit 41b912933d
24 changed files with 741 additions and 53 deletions

View File

@@ -11,9 +11,13 @@ using namespace EditorWindowSupport;
EditorWindowSession::EditorWindowSession(
std::string windowId,
std::wstring title,
EditorWindowCategory category,
EditorWindowChromePolicy chromePolicy,
bool primary) {
m_state.window.windowId = std::move(windowId);
m_state.window.title = std::move(title);
m_state.window.category = category;
m_state.window.chromePolicy = chromePolicy;
m_state.window.primary = primary;
UpdateCachedTitleText();
}
@@ -30,6 +34,14 @@ bool EditorWindowSession::HasHwnd() const {
return m_state.window.hwnd != nullptr;
}
EditorWindowCategory EditorWindowSession::GetCategory() const {
return m_state.window.category;
}
const EditorWindowChromePolicy& EditorWindowSession::GetChromePolicy() const {
return m_state.window.chromePolicy;
}
EditorWindowLifecycleState EditorWindowSession::GetLifecycleState() const {
return m_state.window.lifecycle;
}
@@ -38,6 +50,14 @@ bool EditorWindowSession::IsPrimary() const {
return m_state.window.primary;
}
bool EditorWindowSession::IsWorkspaceWindow() const {
return m_state.window.category == EditorWindowCategory::Workspace;
}
bool EditorWindowSession::IsUtilityWindow() const {
return m_state.window.category == EditorWindowCategory::Utility;
}
bool EditorWindowSession::IsClosing() const {
return m_state.window.lifecycle == EditorWindowLifecycleState::Closing;
}
@@ -92,17 +112,17 @@ void EditorWindowSession::SetTitle(std::wstring title) {
void EditorWindowSession::QueueCompletedImmediateFrame(
EditorWindowFrameTransferRequests transferRequests) {
m_hasQueuedCompletedImmediateFrame = true;
if (transferRequests.beginGlobalTabDrag.has_value()) {
m_queuedImmediateFrameTransferRequests.beginGlobalTabDrag =
std::move(transferRequests.beginGlobalTabDrag);
if (transferRequests.workspace.beginGlobalTabDrag.has_value()) {
m_queuedImmediateFrameTransferRequests.workspace.beginGlobalTabDrag =
std::move(transferRequests.workspace.beginGlobalTabDrag);
}
if (transferRequests.detachPanel.has_value()) {
m_queuedImmediateFrameTransferRequests.detachPanel =
std::move(transferRequests.detachPanel);
if (transferRequests.workspace.detachPanel.has_value()) {
m_queuedImmediateFrameTransferRequests.workspace.detachPanel =
std::move(transferRequests.workspace.detachPanel);
}
if (transferRequests.openUtilityWindow.has_value()) {
m_queuedImmediateFrameTransferRequests.openUtilityWindow =
std::move(transferRequests.openUtilityWindow);
if (transferRequests.utility.openUtilityWindow.has_value()) {
m_queuedImmediateFrameTransferRequests.utility.openUtilityWindow =
std::move(transferRequests.utility.openUtilityWindow);
}
}