Files
XCEngine/new_editor/app/Application.h

84 lines
3.0 KiB
C
Raw Normal View History

2026-04-05 04:55:25 +08:00
#pragma once
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <Host/AutoScreenshot.h>
#include <Host/InputModifierTracker.h>
#include <Host/NativeRenderer.h>
2026-04-10 16:40:11 +08:00
#include <XCEditor/Foundation/UIEditorShortcutManager.h>
#include <XCEditor/Shell/UIEditorShellAsset.h>
#include <XCEditor/Shell/UIEditorShellInteraction.h>
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
#include <windows.h>
#include <windowsx.h>
2026-04-05 04:55:25 +08:00
#include <cstdint>
#include <filesystem>
2026-04-05 04:55:25 +08:00
#include <string>
2026-04-10 16:40:11 +08:00
#include <string_view>
2026-04-05 04:55:25 +08:00
#include <vector>
namespace XCEngine::UI::Editor {
2026-04-05 04:55:25 +08:00
2026-04-10 16:40:11 +08:00
class Application : public UIEditorHostCommandHandler {
2026-04-05 04:55:25 +08:00
public:
2026-04-10 16:40:11 +08:00
Application() = default;
int Run(HINSTANCE hInstance, int nCmdShow);
2026-04-05 04:55:25 +08:00
2026-04-10 16:40:11 +08:00
UIEditorHostCommandEvaluationResult EvaluateHostCommand(
std::string_view commandId) const override;
UIEditorHostCommandDispatchResult DispatchHostCommand(
std::string_view commandId) override;
2026-04-05 04:55:25 +08:00
2026-04-10 16:40:11 +08:00
private:
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
2026-04-05 04:55:25 +08:00
bool Initialize(HINSTANCE hInstance, int nCmdShow);
void Shutdown();
void RenderFrame();
void OnResize(UINT width, UINT height);
2026-04-10 16:40:11 +08:00
void ApplyHostCaptureRequests(const UIEditorShellInteractionResult& result);
bool HasInteractiveCaptureState() const;
UIEditorShellInteractionDefinition BuildShellDefinition() const;
void UpdateLastStatus(const UIEditorShellInteractionResult& result);
void QueuePointerEvent(
::XCEngine::UI::UIInputEventType type,
::XCEngine::UI::UIPointerButton button,
WPARAM wParam,
LPARAM lParam);
void QueuePointerLeaveEvent();
void QueuePointerWheelEvent(short wheelDelta, WPARAM wParam, LPARAM lParam);
void QueueKeyEvent(::XCEngine::UI::UIInputEventType type, WPARAM wParam, LPARAM lParam);
void QueueCharacterEvent(WPARAM wParam, LPARAM lParam);
void QueueWindowFocusEvent(::XCEngine::UI::UIInputEventType type);
static std::filesystem::path ResolveRepoRootPath();
2026-04-05 04:55:25 +08:00
HWND m_hwnd = nullptr;
HINSTANCE m_hInstance = nullptr;
ATOM m_windowClassAtom = 0;
2026-04-10 16:40:11 +08:00
::XCEngine::UI::Editor::Host::NativeRenderer m_renderer = {};
::XCEngine::UI::Editor::Host::AutoScreenshotController m_autoScreenshot = {};
::XCEngine::UI::Editor::Host::InputModifierTracker m_inputModifierTracker = {};
EditorShellAsset m_shellAsset = {};
EditorShellAssetValidationResult m_shellValidation = {};
UIEditorWorkspaceController m_workspaceController = {};
UIEditorShortcutManager m_shortcutManager = {};
UIEditorShellInteractionServices m_shellServices = {};
2026-04-10 16:40:11 +08:00
UIEditorShellInteractionState m_shellInteractionState = {};
UIEditorShellInteractionFrame m_shellFrame = {};
std::vector<::XCEngine::UI::UIInputEvent> m_pendingInputEvents = {};
bool m_trackingMouseLeave = false;
2026-04-10 16:40:11 +08:00
std::string m_validationMessage = {};
std::string m_lastStatus = {};
std::string m_lastMessage = {};
2026-04-05 04:55:25 +08:00
};
int RunXCUIEditorApp(HINSTANCE hInstance, int nCmdShow);
} // namespace XCEngine::UI::Editor