148 lines
5.6 KiB
C++
148 lines
5.6 KiB
C++
#pragma once
|
|
|
|
#include <Platform/Win32/BorderlessWindowChrome.h>
|
|
#include <Platform/Win32/HostRuntimeState.h>
|
|
|
|
namespace XCEngine::UI {
|
|
|
|
class UIDrawList;
|
|
|
|
} // namespace XCEngine::UI
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
class EditorContext;
|
|
class EditorWindow;
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|
|
|
|
namespace XCEngine::UI::Editor::App::Internal {
|
|
|
|
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 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;
|
|
|
|
bool HandleSystemCommand(
|
|
EditorWindow& window,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive,
|
|
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,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive);
|
|
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,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive,
|
|
LPARAM lParam);
|
|
bool HandleChromeDoubleClick(
|
|
EditorWindow& window,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive,
|
|
LPARAM lParam);
|
|
bool HandleChromeDragRestorePointerMove(
|
|
EditorWindow& window,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive);
|
|
void ClearChromeDragRestoreState(EditorWindow& window);
|
|
void ClearChromeState(EditorWindow& window);
|
|
Host::BorderlessWindowChromeHitTarget HitTestChrome(
|
|
const EditorWindow& window,
|
|
LPARAM lParam) const;
|
|
Host::BorderlessWindowChromeLayout ResolveChromeLayout(
|
|
const EditorWindow& window,
|
|
float clientWidthDips) const;
|
|
bool ShouldUseDetachedTitleBarTabStrip(const EditorWindow& window) const;
|
|
void AppendChrome(
|
|
const EditorWindow& 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,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive,
|
|
const RECT& targetRect);
|
|
void ToggleMaximizeRestore(
|
|
EditorWindow& window,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive);
|
|
void ExecuteChromeAction(
|
|
EditorWindow& window,
|
|
EditorContext& editorContext,
|
|
bool globalTabDragActive,
|
|
Host::BorderlessWindowChromeHitTarget target);
|
|
|
|
private:
|
|
Host::BorderlessWindowChromeState m_chromeState = {};
|
|
Host::HostRuntimeState m_runtimeState = {};
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::App::Internal
|