104 lines
2.9 KiB
C++
104 lines
2.9 KiB
C++
#pragma once
|
|
|
|
#ifndef NOMINMAX
|
|
#define NOMINMAX
|
|
#endif
|
|
|
|
#include <windows.h>
|
|
|
|
#include <filesystem>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace XCEngine::UI::Editor {
|
|
|
|
class UIEditorWindowWorkspaceController;
|
|
class UIEditorWorkspaceController;
|
|
|
|
struct UIEditorWindowWorkspaceSet;
|
|
struct UIEditorWindowWorkspaceState;
|
|
|
|
} // namespace XCEngine::UI::Editor
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
class EditorContext;
|
|
class EditorWindow;
|
|
struct EditorWindowPanelTransferRequest;
|
|
struct EditorWindowFrameTransferRequests;
|
|
|
|
struct EditorWindowHostConfig {
|
|
HINSTANCE hInstance = nullptr;
|
|
const wchar_t* windowClassName = L"";
|
|
DWORD windowStyle = 0;
|
|
const wchar_t* primaryWindowTitle = L"";
|
|
void* windowUserData = nullptr;
|
|
};
|
|
|
|
namespace Internal {
|
|
class EditorWindowHostRuntime;
|
|
class EditorWindowWorkspaceCoordinator;
|
|
}
|
|
|
|
class EditorWindowManager final {
|
|
public:
|
|
struct CreateParams {
|
|
std::string windowId = {};
|
|
std::wstring title = {};
|
|
int initialX = CW_USEDEFAULT;
|
|
int initialY = CW_USEDEFAULT;
|
|
int initialWidth = 1540;
|
|
int initialHeight = 940;
|
|
int showCommand = SW_SHOW;
|
|
bool primary = false;
|
|
bool autoCaptureOnStartup = false;
|
|
};
|
|
|
|
EditorWindowManager(
|
|
EditorWindowHostConfig hostConfig,
|
|
std::filesystem::path repoRoot,
|
|
EditorContext& editorContext);
|
|
~EditorWindowManager();
|
|
|
|
EditorWindowManager(const EditorWindowManager&) = delete;
|
|
EditorWindowManager& operator=(const EditorWindowManager&) = delete;
|
|
EditorWindowManager(EditorWindowManager&&) = delete;
|
|
EditorWindowManager& operator=(EditorWindowManager&&) = delete;
|
|
|
|
EditorWindow* CreateEditorWindow(
|
|
UIEditorWorkspaceController workspaceController,
|
|
const CreateParams& params);
|
|
void HandlePendingNativeWindowCreated(HWND hwnd);
|
|
void Shutdown();
|
|
|
|
EditorWindow* FindWindow(HWND hwnd);
|
|
const EditorWindow* FindWindow(HWND hwnd) const;
|
|
EditorWindow* FindWindow(std::string_view windowId);
|
|
const EditorWindow* FindWindow(std::string_view windowId) const;
|
|
EditorWindow* FindPrimaryWindow();
|
|
const EditorWindow* FindPrimaryWindow() const;
|
|
|
|
bool HasWindows() const;
|
|
void DestroyClosedWindows();
|
|
void RenderAllWindows();
|
|
|
|
bool IsGlobalTabDragActive() const;
|
|
bool OwnsActiveGlobalTabDrag(std::string_view windowId) const;
|
|
void EndGlobalTabDragSession();
|
|
void HandleDestroyedWindow(HWND hwnd);
|
|
void HandleWindowFrameTransferRequests(
|
|
EditorWindow& sourceWindow,
|
|
EditorWindowFrameTransferRequests&& transferRequests);
|
|
bool HandleGlobalTabDragPointerMove(HWND hwnd);
|
|
bool HandleGlobalTabDragPointerButtonUp(HWND hwnd);
|
|
|
|
private:
|
|
std::unique_ptr<Internal::EditorWindowHostRuntime> m_hostRuntime = {};
|
|
std::unique_ptr<Internal::EditorWindowWorkspaceCoordinator> m_workspaceCoordinator = {};
|
|
};
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|
|
|