Refine editor host boundary
This commit is contained in:
148
editor/app/Host/Win32/Chrome/EditorWindowChromeController.h
Normal file
148
editor/app/Host/Win32/Chrome/EditorWindowChromeController.h
Normal file
@@ -0,0 +1,148 @@
|
||||
#pragma once
|
||||
|
||||
#include "BorderlessWindowChrome.h"
|
||||
#include "HostRuntimeState.h"
|
||||
|
||||
namespace XCEngine::UI {
|
||||
|
||||
class UIDrawList;
|
||||
|
||||
} // namespace XCEngine::UI
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
class EditorHostWindow;
|
||||
class EditorWindow;
|
||||
class EditorWindowHostCoordinator;
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
class EditorWindowChromeController final {
|
||||
public:
|
||||
EditorWindowChromeController() = default;
|
||||
~EditorWindowChromeController() = default;
|
||||
|
||||
EditorWindowChromeController(const EditorWindowChromeController&) = delete;
|
||||
EditorWindowChromeController& operator=(const EditorWindowChromeController&) = delete;
|
||||
EditorWindowChromeController(EditorWindowChromeController&&) = delete;
|
||||
EditorWindowChromeController& operator=(EditorWindowChromeController&&) = delete;
|
||||
|
||||
void Reset();
|
||||
|
||||
void SetWindowDpi(UINT dpi);
|
||||
UINT GetWindowDpi() const;
|
||||
float GetDpiScale(float baseDpiScale) const;
|
||||
|
||||
void BeginInteractiveResize();
|
||||
void EndInteractiveResize();
|
||||
|
||||
void BeginBorderlessResize(
|
||||
Host::BorderlessWindowResizeEdge edge,
|
||||
const POINT& initialScreenPoint,
|
||||
const RECT& initialWindowRect);
|
||||
void EndBorderlessResize();
|
||||
bool IsBorderlessResizeActive() const;
|
||||
Host::BorderlessWindowResizeEdge GetBorderlessResizeEdge() const;
|
||||
const POINT& GetBorderlessResizeInitialScreenPoint() const;
|
||||
const RECT& GetBorderlessResizeInitialWindowRect() const;
|
||||
void SetHoveredBorderlessResizeEdge(Host::BorderlessWindowResizeEdge edge);
|
||||
Host::BorderlessWindowResizeEdge GetHoveredBorderlessResizeEdge() const;
|
||||
|
||||
void SetPredictedClientPixelSize(UINT width, UINT height);
|
||||
void ClearPredictedClientPixelSize();
|
||||
bool TryGetPredictedClientPixelSize(UINT& outWidth, UINT& outHeight) const;
|
||||
void MarkPredictedClientPixelSizePresented();
|
||||
bool ConsumePresentedPredictedClientPixelSizeMatch(UINT width, UINT height);
|
||||
void RequestSkipNextSteadyStateFrame();
|
||||
bool ConsumeSkipNextSteadyStateFrame();
|
||||
|
||||
void SetBorderlessWindowMaximized(bool maximized);
|
||||
bool IsBorderlessWindowMaximized() const;
|
||||
void SetBorderlessWindowRestoreRect(const RECT& rect);
|
||||
bool TryGetBorderlessWindowRestoreRect(RECT& outRect) const;
|
||||
|
||||
void BeginBorderlessWindowDragRestore(const POINT& initialScreenPoint);
|
||||
void EndBorderlessWindowDragRestore();
|
||||
bool IsBorderlessWindowDragRestoreArmed() const;
|
||||
const POINT& GetBorderlessWindowDragRestoreInitialScreenPoint() const;
|
||||
|
||||
Host::BorderlessWindowChromeHitTarget GetHoveredChromeTarget() const;
|
||||
void SetHoveredChromeTarget(Host::BorderlessWindowChromeHitTarget target);
|
||||
Host::BorderlessWindowChromeHitTarget GetPressedChromeTarget() const;
|
||||
void SetPressedChromeTarget(Host::BorderlessWindowChromeHitTarget target);
|
||||
void ResetChromeState();
|
||||
bool IsChromeStateClear() const;
|
||||
const Host::BorderlessWindowChromeState& GetChromeState() const;
|
||||
void InitializeWindowChrome(EditorWindow& window);
|
||||
|
||||
bool HandleSystemCommand(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
WPARAM wParam);
|
||||
bool HandleGetMinMaxInfo(const EditorWindow& window, LPARAM lParam) const;
|
||||
LRESULT HandleNcCalcSize(const EditorWindow& window, WPARAM wParam, LPARAM lParam) const;
|
||||
|
||||
bool UpdateResizeHover(EditorWindow& window, LPARAM lParam);
|
||||
bool HandleResizeButtonDown(EditorWindow& window, LPARAM lParam);
|
||||
bool HandleResizeButtonUp(EditorWindow& window);
|
||||
bool HandleResizePointerMove(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator);
|
||||
void ClearResizeState(EditorWindow& window);
|
||||
void ForceClearResizeState(EditorWindow& window);
|
||||
Host::BorderlessWindowResizeEdge HitTestResizeEdge(
|
||||
const EditorWindow& window,
|
||||
LPARAM lParam) const;
|
||||
|
||||
bool UpdateChromeHover(EditorWindow& window, LPARAM lParam);
|
||||
bool HandleChromeButtonDown(EditorWindow& window, LPARAM lParam);
|
||||
bool HandleChromeButtonUp(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
LPARAM lParam);
|
||||
bool HandleChromeDoubleClick(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
LPARAM lParam);
|
||||
bool HandleChromeDragRestorePointerMove(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator);
|
||||
void ClearChromeDragRestoreState(EditorWindow& window);
|
||||
void ClearChromeState(EditorWindow& window);
|
||||
Host::BorderlessWindowChromeHitTarget HitTestChrome(
|
||||
const EditorWindow& window,
|
||||
LPARAM lParam) const;
|
||||
Host::BorderlessWindowChromeLayout ResolveChromeLayout(
|
||||
const EditorHostWindow& window,
|
||||
float clientWidthDips) const;
|
||||
bool ShouldUseDetachedTitleBarTabStrip(const EditorHostWindow& window) const;
|
||||
void AppendChrome(
|
||||
const EditorHostWindow& window,
|
||||
::XCEngine::UI::UIDrawList& drawList,
|
||||
float clientWidthDips) const;
|
||||
void ApplyResizeCursorHoverPriority();
|
||||
bool QueryCurrentWindowRect(const EditorWindow& window, RECT& outRect) const;
|
||||
bool QueryBorderlessWindowWorkAreaRect(const EditorWindow& window, RECT& outRect) const;
|
||||
bool ApplyPredictedWindowRectTransition(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
const RECT& targetRect);
|
||||
void SetWindowTopmost(bool topmost);
|
||||
bool IsWindowTopmost() const;
|
||||
bool ApplyWindowTopmost(EditorWindow& window, bool topmost);
|
||||
void ToggleMaximizeRestore(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator);
|
||||
void ExecuteChromeAction(
|
||||
EditorWindow& window,
|
||||
EditorWindowHostCoordinator& hostCoordinator,
|
||||
Host::BorderlessWindowChromeHitTarget target);
|
||||
|
||||
private:
|
||||
Host::BorderlessWindowChromeState m_chromeState = {};
|
||||
Host::HostRuntimeState m_runtimeState = {};
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
Reference in New Issue
Block a user