Refine editor host boundary
This commit is contained in:
83
editor/app/Host/Win32/Windowing/EditorWindowHostRuntime.h
Normal file
83
editor/app/Host/Win32/Windowing/EditorWindowHostRuntime.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include "Windowing/EditorWindow.h"
|
||||
#include "Windowing/EditorWindowHostConfig.h"
|
||||
#include "EditorWindowHostCoordinator.h"
|
||||
#include "EditorWindowHostInterfaces.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor::App {
|
||||
|
||||
class EditorWindow;
|
||||
class EditorWindowHostRuntime final : public EditorWindowHostRuntimeServices {
|
||||
public:
|
||||
EditorWindowHostRuntime(
|
||||
EditorWindowHostConfig hostConfig,
|
||||
std::filesystem::path repoRoot,
|
||||
std::filesystem::path captureRoot);
|
||||
~EditorWindowHostRuntime();
|
||||
|
||||
bool CreateHostWindow(
|
||||
EditorHostWindow& window,
|
||||
const EditorWindowCreateParams& params) override;
|
||||
void BindHostCoordinator(EditorWindowHostCoordinator& hostCoordinator) override;
|
||||
void HandlePendingNativeWindowCreated(HWND hwnd);
|
||||
|
||||
EditorWindow* FindWindow(HWND hwnd);
|
||||
const EditorWindow* FindWindow(HWND hwnd) const;
|
||||
EditorHostWindow* FindWindowById(std::string_view windowId) override;
|
||||
const EditorHostWindow* FindWindowById(std::string_view windowId) const override;
|
||||
EditorWindow* FindPrimaryWindow();
|
||||
const EditorWindow* FindPrimaryWindow() const;
|
||||
|
||||
bool HasWindows() const;
|
||||
std::vector<EditorHostWindow*> GetWindows() override;
|
||||
std::vector<const EditorHostWindow*> GetWindows() const override;
|
||||
std::wstring_view GetPrimaryWindowTitle() const override;
|
||||
bool TryGetCursorScreenPoint(EditorWindowScreenPoint& outPoint) const override;
|
||||
EditorWindowScreenRect ResolveFloatingPlacement(
|
||||
const EditorWindowScreenPoint& screenPoint,
|
||||
int preferredWidth,
|
||||
int preferredHeight) const override;
|
||||
EditorHostWindow* FindWindowFromScreenPoint(
|
||||
const EditorWindowScreenPoint& screenPoint) override;
|
||||
const EditorHostWindow* FindWindowFromScreenPoint(
|
||||
const EditorWindowScreenPoint& screenPoint) const override;
|
||||
void ReapDestroyedWindows() override;
|
||||
std::string DescribeWindows() const override;
|
||||
|
||||
const EditorWindowHostConfig& GetHostConfig() const {
|
||||
return m_hostConfig;
|
||||
}
|
||||
|
||||
const std::filesystem::path& GetRepoRoot() const {
|
||||
return m_repoRoot;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<EditorWindow>>& GetWindowStorage() {
|
||||
return m_windows;
|
||||
}
|
||||
|
||||
const std::vector<std::unique_ptr<EditorWindow>>& GetWindowStorage() const {
|
||||
return m_windows;
|
||||
}
|
||||
|
||||
void LogRuntimeTrace(std::string_view channel, std::string_view message) const override;
|
||||
|
||||
private:
|
||||
EditorWindow* FindWindowByIdImpl(std::string_view windowId);
|
||||
const EditorWindow* FindWindowByIdImpl(std::string_view windowId) const;
|
||||
|
||||
EditorWindowHostConfig m_hostConfig = {};
|
||||
std::filesystem::path m_repoRoot = {};
|
||||
std::filesystem::path m_captureRoot = {};
|
||||
std::vector<std::unique_ptr<EditorWindow>> m_windows = {};
|
||||
EditorWindow* m_pendingCreateWindow = nullptr;
|
||||
EditorWindowHostCoordinator* m_hostCoordinator = nullptr;
|
||||
};
|
||||
|
||||
} // namespace XCEngine::UI::Editor::App
|
||||
Reference in New Issue
Block a user