2026-04-15 08:24:06 +08:00
|
|
|
#include "Platform/Win32/EditorWindow.h"
|
2026-04-15 22:47:42 +08:00
|
|
|
#include "Platform/Win32/EditorWindowRuntimeInternal.h"
|
2026-04-15 08:24:06 +08:00
|
|
|
|
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
|
|
2026-04-15 22:47:42 +08:00
|
|
|
using namespace EditorWindowInternal;
|
2026-04-15 08:24:06 +08:00
|
|
|
|
|
|
|
|
EditorWindow::EditorWindow(
|
|
|
|
|
std::string windowId,
|
|
|
|
|
std::wstring title,
|
|
|
|
|
bool primary,
|
|
|
|
|
UIEditorWorkspaceController workspaceController)
|
|
|
|
|
: m_window{
|
|
|
|
|
nullptr,
|
|
|
|
|
std::move(windowId),
|
|
|
|
|
std::move(title),
|
|
|
|
|
{},
|
|
|
|
|
primary }
|
|
|
|
|
, m_composition{ std::move(workspaceController), {} } {
|
|
|
|
|
UpdateCachedTitleText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string_view EditorWindow::GetWindowId() const {
|
|
|
|
|
return m_window.windowId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWND EditorWindow::GetHwnd() const {
|
|
|
|
|
return m_window.hwnd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::HasHwnd() const {
|
|
|
|
|
return m_window.hwnd != nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::IsPrimary() const {
|
|
|
|
|
return m_window.primary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::IsRenderReady() const {
|
|
|
|
|
return m_render.ready;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::IsTrackingMouseLeave() const {
|
|
|
|
|
return m_input.trackingMouseLeave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::HasHoveredBorderlessResizeEdge() const {
|
|
|
|
|
return m_chrome.runtime.GetHoveredBorderlessResizeEdge() !=
|
|
|
|
|
Host::BorderlessWindowResizeEdge::None;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::wstring& EditorWindow::GetTitle() const {
|
|
|
|
|
return m_window.title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UIEditorWorkspaceController& EditorWindow::GetWorkspaceController() const {
|
|
|
|
|
return m_composition.workspaceController;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIEditorWorkspaceController& EditorWindow::GetWorkspaceController() {
|
|
|
|
|
return m_composition.workspaceController;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const EditorShellRuntime& EditorWindow::GetShellRuntime() const {
|
|
|
|
|
return m_composition.shellRuntime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EditorShellRuntime& EditorWindow::GetShellRuntime() {
|
|
|
|
|
return m_composition.shellRuntime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UIEditorShellInteractionFrame& EditorWindow::GetShellFrame() const {
|
|
|
|
|
return m_composition.shellRuntime.GetShellFrame();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const UIEditorShellInteractionState& EditorWindow::GetShellInteractionState() const {
|
|
|
|
|
return m_composition.shellRuntime.GetShellInteractionState();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 13:22:58 +08:00
|
|
|
void EditorWindow::SetExternalDockHostDropPreview(
|
|
|
|
|
const Widgets::UIEditorDockHostDropPreviewState& preview) {
|
|
|
|
|
m_composition.shellRuntime.SetExternalDockHostDropPreview(preview);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::ClearExternalDockHostDropPreview() {
|
|
|
|
|
m_composition.shellRuntime.ClearExternalDockHostDropPreview();
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-15 08:24:06 +08:00
|
|
|
void EditorWindow::AttachHwnd(HWND hwnd) {
|
|
|
|
|
m_window.hwnd = hwnd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::MarkDestroyed() {
|
|
|
|
|
m_window.hwnd = nullptr;
|
|
|
|
|
m_input.trackingMouseLeave = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::SetTrackingMouseLeave(bool trackingMouseLeave) {
|
|
|
|
|
m_input.trackingMouseLeave = trackingMouseLeave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::SetTitle(std::wstring title) {
|
|
|
|
|
m_window.title = std::move(title);
|
|
|
|
|
UpdateCachedTitleText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController) {
|
|
|
|
|
m_composition.workspaceController = std::move(workspaceController);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::InvalidateHostWindow() const {
|
|
|
|
|
if (m_window.hwnd != nullptr && IsWindow(m_window.hwnd)) {
|
|
|
|
|
InvalidateRect(m_window.hwnd, nullptr, FALSE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool EditorWindow::IsVerboseRuntimeTraceEnabled() {
|
|
|
|
|
static const bool s_enabled = ResolveVerboseRuntimeTraceEnabled();
|
|
|
|
|
return s_enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorWindow::UpdateCachedTitleText() {
|
|
|
|
|
m_window.titleText = WideToUtf8(m_window.title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|