Files
XCEngine/new_editor/app/Bootstrap/Application.h

71 lines
2.0 KiB
C++

#pragma once
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "Platform/Win32/WindowMessageHost.h"
#include <windows.h>
#include <filesystem>
#include <memory>
#include <optional>
#include <string_view>
namespace XCEngine::UI::Editor {
namespace App {
class EditorContext;
class EditorWindowManager;
}
}
namespace XCEngine::UI::Editor {
class Application final : public Host::WindowMessageHost {
public:
Application();
~Application();
Application(const Application&) = delete;
Application& operator=(const Application&) = delete;
Application(Application&&) = delete;
Application& operator=(Application&&) = delete;
int Run(HINSTANCE hInstance, int nCmdShow);
App::EditorContext& GetEditorContext() override;
const App::EditorContext& GetEditorContext() const override;
bool IsGlobalTabDragActive() const override;
bool OwnsActiveGlobalTabDrag(std::string_view windowId) const override;
void EndGlobalTabDragSession() override;
void HandleDestroyedWindow(HWND hwnd) override;
bool HandleGlobalTabDragPointerMove(HWND hwnd) override;
bool HandleGlobalTabDragPointerButtonUp(HWND hwnd) override;
private:
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
bool Initialize(HINSTANCE hInstance, int nCmdShow);
void Shutdown();
bool RegisterWindowClass();
static std::filesystem::path ResolveRepoRootPath();
static LONG WINAPI HandleUnhandledException(EXCEPTION_POINTERS* exceptionInfo);
void InitializeSmokeTestConfig();
void TickSmokeTest();
HINSTANCE m_hInstance = nullptr;
ATOM m_windowClassAtom = 0;
std::filesystem::path m_repoRoot = {};
std::unique_ptr<App::EditorContext> m_editorContext = {};
std::unique_ptr<App::EditorWindowManager> m_windowManager = {};
bool m_smokeTestEnabled = false;
int m_smokeTestFrameLimit = 0;
int m_smokeTestRenderedFrames = 0;
bool m_smokeTestCloseRequested = false;
};
int RunXCUIEditorApp(HINSTANCE hInstance, int nCmdShow);
} // namespace XCEngine::UI::Editor