Files
XCEngine/editor/app/Windowing/EditorWindowInstance.h

126 lines
5.4 KiB
C++

#pragma once
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "Windowing/Host/EditorWindowHostInterfaces.h"
#include <memory>
#include <string>
namespace XCEngine::UI::Editor::App {
class EditorWindowRuntimeController;
class EditorWindowInstance final : public EditorHostWindow {
public:
EditorWindowInstance(
std::string windowId,
std::wstring title,
EditorWindowCategory category,
EditorWindowChromePolicy chromePolicy,
bool primary,
std::unique_ptr<EditorWindowRuntimeController> runtimeController);
~EditorWindowInstance() override;
EditorWindowInstance(const EditorWindowInstance&) = delete;
EditorWindowInstance& operator=(const EditorWindowInstance&) = delete;
EditorWindowInstance(EditorWindowInstance&&) = delete;
EditorWindowInstance& operator=(EditorWindowInstance&&) = delete;
std::string_view GetWindowId() const override;
EditorWindowLifecycleState GetLifecycleState() const override;
const EditorWindowChromePolicy& GetChromePolicy() const override;
bool IsPrimary() const override;
bool IsWorkspaceWindow() const override;
bool IsUtilityWindow() const override;
bool IsClosing() const override;
bool IsDestroyed() const override;
bool HasLiveHostWindow() const override;
const std::wstring& GetTitle() const override;
std::string_view GetCachedTitleText() const override;
const EditorWorkspaceWindowProjection* TryGetWorkspaceProjection() const override;
EditorWindowDockHostBinding* TryGetDockHostBinding() override;
const EditorWindowDockHostBinding* TryGetDockHostBinding() const override;
const EditorWindowInputFeedbackBinding* TryGetInputFeedbackBinding() const override;
const EditorWindowTitleBarBinding* TryGetTitleBarBinding() const override;
const UIEditorShellInteractionFrame& GetShellFrame() const override;
const UIEditorShellInteractionState& GetShellInteractionState() const override;
::XCEngine::UI::UISize ResolveMinimumOuterSize() const override;
UIEditorTextMeasurer& GetTextMeasurer() override;
const UIEditorTextMeasurer& GetTextMeasurer() const override;
const ::XCEngine::UI::UITextureHandle& GetTitleBarLogoIcon() const override;
std::string BuildFrameRateText() const override;
::XCEngine::UI::UIPoint ConvertScreenPixelsToClientDips(
const EditorWindowScreenPoint& screenPoint) const override;
bool TryResolveDockTabDragHotspot(
std::string_view nodeId,
std::string_view panelId,
const EditorWindowScreenPoint& screenPoint,
EditorWindowScreenPoint& outHotspot) const override;
bool TryResolveDockTabDropTarget(
const EditorWindowScreenPoint& screenPoint,
UIEditorDockHostTabDropTarget& outTarget) const override;
void InvalidateHostWindow() const override;
void SetPrimary(bool primary) override;
void SetTitle(std::wstring title) override;
void ApplyHostWindowTitle() override;
void RefreshWorkspaceProjection(EditorWorkspaceWindowProjection projection) override;
void ResetInteractionState() override;
void SetDpiScale(float dpiScale) override;
bool ApplyResize(std::uint32_t width, std::uint32_t height) override;
void AcquirePointerCapture(EditorWindowPointerCaptureOwner owner) override;
void ReleasePointerCapture(EditorWindowPointerCaptureOwner owner) override;
void AttachNativePeer(EditorWindowNativePeer& nativePeer) override;
void DetachNativePeer(EditorWindowNativePeer& nativePeer) override;
void MarkNativeAttached() override;
void MarkInitializing() override;
void MarkRunning() override;
void MarkClosing() override;
void MarkDestroyed() override;
bool IsRenderReady() const override;
bool InitializeRuntime(
const EditorHostWindowRuntimeInitializationParams& params) override;
EditorWindowFrameTransferRequests RenderHostFrame(
bool globalTabDragActive) override;
void ValidateHostFrame() const override;
void RequestSkipNextSteadyStateFrame() override;
bool ConsumeSkipNextSteadyStateFrame() override;
void Shutdown() override;
bool TryGetHostScreenRect(EditorWindowScreenRect& outRect) const override;
void SetHostScreenPosition(const EditorWindowScreenPoint& screenPoint) override;
void FocusHostWindow() override;
void PostCloseToHost() override;
void DestroyHostWindow() override;
void RequestManualScreenshot(std::string reason) override;
private:
void UpdateCachedTitleText();
EditorWindowFrameTransferRequests RenderRuntimeFrame(
bool globalTabDragActive,
const EditorNativeWindowFrameSnapshot& frameSnapshot,
::XCEngine::UI::UIDrawData& drawData);
std::string m_windowId = {};
std::wstring m_title = {};
std::string m_cachedTitleText = {};
EditorWindowCategory m_category = EditorWindowCategory::Workspace;
EditorWindowChromePolicy m_chromePolicy = {};
bool m_primary = false;
EditorWindowLifecycleState m_lifecycle = EditorWindowLifecycleState::PendingNativeCreate;
EditorWindowNativePeer* m_nativePeer = nullptr;
std::unique_ptr<EditorWindowRuntimeController> m_runtime = {};
};
std::unique_ptr<EditorWindowInstance> CreateEditorWindowInstance(
std::string windowId,
std::wstring title,
EditorWindowCategory category,
EditorWindowChromePolicy chromePolicy,
bool primary,
std::unique_ptr<EditorWindowRuntimeController> runtimeController);
} // namespace XCEngine::UI::Editor::App