关键节点
This commit is contained in:
192
editor/app/Platform/Win32/Windowing/EditorWindow.h
Normal file
192
editor/app/Platform/Win32/Windowing/EditorWindow.h
Normal file
@@ -0,0 +1,192 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include "Platform/Win32/Windowing/EditorWindowPointerCapture.h"
|
||||
#include "Platform/Win32/Windowing/EditorWindowSession.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI {
|
||||
|
||||
class UIDrawData;
|
||||
class UIDrawList;
|
||||
|
||||
struct UIPoint;
|
||||
struct UIRect;
|
||||
struct UIInputEvent;
|
||||
struct UIInputModifiers;
|
||||
|
||||
enum class UIPointerButton : std::uint8_t;
|
||||
enum class UIInputEventType : std::uint8_t;
|
||||
|
||||
} // namespace XCEngine::UI
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
struct UIEditorDockHostTabDropTarget;
|
||||
class UIEditorWorkspaceController;
|
||||
|
||||
struct UIEditorDockHostInteractionState;
|
||||
struct UIEditorShellInteractionFrame;
|
||||
struct UIEditorShellInteractionState;
|
||||
struct UIEditorShellInteractionResult;
|
||||
|
||||
namespace Widgets {
|
||||
struct UIEditorDockHostDropPreviewState;
|
||||
}
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
class EditorContext;
|
||||
class EditorWindowContentController;
|
||||
class EditorWindowChromeController;
|
||||
class EditorWindowFrameDriver;
|
||||
class EditorWindowFrameOrchestrator;
|
||||
class EditorWindowHostRuntime;
|
||||
class EditorWindowInputController;
|
||||
class EditorWindowLifecycleCoordinator;
|
||||
class EditorWindowMessageDispatcher;
|
||||
class EditorWindowRuntimeController;
|
||||
class EditorWindowWorkspaceCoordinator;
|
||||
class EditorWindowSession;
|
||||
|
||||
class EditorWindow {
|
||||
public:
|
||||
EditorWindow(
|
||||
std::string windowId,
|
||||
std::wstring title,
|
||||
bool primary,
|
||||
std::unique_ptr<EditorWindowContentController> contentController);
|
||||
~EditorWindow();
|
||||
|
||||
EditorWindow(const EditorWindow&) = delete;
|
||||
EditorWindow& operator=(const EditorWindow&) = delete;
|
||||
EditorWindow(EditorWindow&&) = delete;
|
||||
EditorWindow& operator=(EditorWindow&&) = delete;
|
||||
|
||||
std::string_view GetWindowId() const;
|
||||
HWND GetHwnd() const;
|
||||
bool HasHwnd() const;
|
||||
EditorWindowLifecycleState GetLifecycleState() const;
|
||||
bool IsPrimary() const;
|
||||
bool IsClosing() const;
|
||||
bool IsDestroyed() const;
|
||||
const std::wstring& GetTitle() const;
|
||||
std::string_view GetCachedTitleText() const;
|
||||
const UIEditorWorkspaceController* TryGetWorkspaceController() const;
|
||||
const UIEditorWorkspaceController& GetWorkspaceController() const;
|
||||
::XCEngine::UI::UIPoint ConvertScreenPixelsToClientDips(const POINT& screenPoint) const;
|
||||
|
||||
private:
|
||||
friend class EditorWindowChromeController;
|
||||
friend class EditorWindowFrameDriver;
|
||||
friend class EditorWindowHostRuntime;
|
||||
friend class EditorWindowMessageDispatcher;
|
||||
friend class EditorWindowLifecycleCoordinator;
|
||||
friend class EditorWindowWorkspaceCoordinator;
|
||||
|
||||
bool IsRenderReady() const;
|
||||
bool TryResolveDockTabDragHotspot(
|
||||
std::string_view nodeId,
|
||||
std::string_view panelId,
|
||||
const POINT& screenPoint,
|
||||
POINT& outHotspot) const;
|
||||
bool TryResolveDockTabDropTarget(
|
||||
const POINT& screenPoint,
|
||||
UIEditorDockHostTabDropTarget& outTarget) const;
|
||||
void InvalidateHostWindow() const;
|
||||
|
||||
void AttachHwnd(HWND hwnd);
|
||||
void MarkInitializing();
|
||||
void MarkRunning();
|
||||
void MarkDestroyed();
|
||||
void MarkClosing();
|
||||
void SetPrimary(bool primary);
|
||||
void SetTitle(std::wstring title);
|
||||
void ReplaceWorkspaceController(UIEditorWorkspaceController workspaceController);
|
||||
|
||||
bool Initialize(
|
||||
const std::filesystem::path& repoRoot,
|
||||
EditorContext& editorContext,
|
||||
const std::filesystem::path& captureRoot,
|
||||
bool autoCaptureOnStartup);
|
||||
void Shutdown();
|
||||
void ResetInteractionState();
|
||||
|
||||
EditorWindowFrameTransferRequests RenderFrame(
|
||||
EditorContext& editorContext,
|
||||
bool globalTabDragActive);
|
||||
EditorWindowFrameTransferRequests OnPaintMessage(
|
||||
EditorContext& editorContext,
|
||||
bool globalTabDragActive);
|
||||
void QueueCompletedImmediateFrame(
|
||||
EditorWindowFrameTransferRequests transferRequests);
|
||||
bool HasQueuedCompletedImmediateFrame() const;
|
||||
EditorWindowFrameTransferRequests ConsumeQueuedCompletedImmediateFrameTransferRequests();
|
||||
void RequestSkipNextSteadyStateFrame();
|
||||
bool ConsumeSkipNextSteadyStateFrame();
|
||||
bool OnResize(UINT width, UINT height);
|
||||
void OnEnterSizeMove();
|
||||
bool OnExitSizeMove();
|
||||
void OnDpiChanged(UINT dpi, const RECT& suggestedRect);
|
||||
|
||||
bool ApplyCurrentCursor() const;
|
||||
bool HasInteractiveCaptureState() const;
|
||||
bool OwnsPointerCapture(EditorWindowPointerCaptureOwner owner) const;
|
||||
void AcquirePointerCapture(EditorWindowPointerCaptureOwner owner);
|
||||
void ReleasePointerCapture(EditorWindowPointerCaptureOwner owner);
|
||||
void ForceReleasePointerCapture();
|
||||
void TryStartImmediateShellPointerCapture(LPARAM lParam);
|
||||
|
||||
void QueuePointerEvent(
|
||||
::XCEngine::UI::UIInputEventType type,
|
||||
::XCEngine::UI::UIPointerButton button,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
bool doubleClick = false);
|
||||
void QueueSyntheticPointerStateSyncEvent(
|
||||
const ::XCEngine::UI::UIInputModifiers& modifiers);
|
||||
void QueuePointerLeaveEvent();
|
||||
void QueuePointerWheelEvent(short wheelDelta, WPARAM wParam, LPARAM lParam);
|
||||
void SyncShellCapturedPointerButtonsFromSystemState();
|
||||
|
||||
bool ApplyWindowResize(UINT width, UINT height);
|
||||
bool QueryCurrentClientPixelSize(UINT& outWidth, UINT& outHeight) const;
|
||||
bool ResolveRenderClientPixelSize(UINT& outWidth, UINT& outHeight) const;
|
||||
::XCEngine::UI::UIRect ResolveWorkspaceBounds(
|
||||
float clientWidthDips,
|
||||
float clientHeightDips) const;
|
||||
EditorWindowFrameTransferRequests RenderRuntimeFrame(
|
||||
EditorContext& editorContext,
|
||||
bool globalTabDragActive,
|
||||
const ::XCEngine::UI::UIRect& workspaceBounds,
|
||||
::XCEngine::UI::UIDrawData& drawData);
|
||||
bool IsPointerInsideClientArea() const;
|
||||
LPCWSTR ResolveCurrentCursorResource() const;
|
||||
float GetDpiScale() const;
|
||||
float PixelsToDips(float pixels) const;
|
||||
::XCEngine::UI::UIPoint ConvertClientPixelsToDips(LONG x, LONG y) const;
|
||||
void ApplyShellRuntimePointerCapture();
|
||||
static bool IsVerboseRuntimeTraceEnabled();
|
||||
|
||||
std::unique_ptr<EditorWindowSession> m_session = {};
|
||||
std::unique_ptr<EditorWindowChromeController> m_chromeController = {};
|
||||
std::unique_ptr<EditorWindowFrameOrchestrator> m_frameOrchestrator = {};
|
||||
std::unique_ptr<EditorWindowInputController> m_inputController = {};
|
||||
std::unique_ptr<EditorWindowRuntimeController> m_runtime = {};
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
Reference in New Issue
Block a user