2026-04-05 04:55:25 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Panel.h"
|
|
|
|
|
|
|
|
|
|
#include "XCUIBackend/XCUIHostedPreviewPresenter.h"
|
|
|
|
|
#include "XCUIBackend/XCUIInputBridge.h"
|
2026-04-05 12:30:03 +08:00
|
|
|
#include "XCUIBackend/XCUIPanelCanvasHost.h"
|
2026-04-05 04:55:25 +08:00
|
|
|
#include "XCUIBackend/XCUILayoutLabRuntime.h"
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2026-04-05 12:53:05 +08:00
|
|
|
#include <string>
|
2026-04-05 04:55:25 +08:00
|
|
|
|
|
|
|
|
namespace XCEngine {
|
|
|
|
|
namespace NewEditor {
|
|
|
|
|
|
2026-04-05 17:41:31 +08:00
|
|
|
struct XCUILayoutLabFrameCompositionRequest {
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIPanelCanvasSession canvasSession = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameSnapshot inputSnapshot = {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct XCUILayoutLabFrameComposition {
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIPanelCanvasSession canvasSession = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameSnapshot inputSnapshot = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIInputBridgeFrameDelta inputDelta = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUILayoutLabInputState inputState = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats previewStats = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewSurfaceDescriptor hostedSurfaceDescriptor = {};
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewSurfaceImage hostedSurfaceImage = {};
|
|
|
|
|
const ::XCEngine::Editor::XCUIBackend::XCUILayoutLabFrameResult* frameResult = nullptr;
|
|
|
|
|
std::string previewPathLabel = {};
|
|
|
|
|
std::string previewStateLabel = {};
|
|
|
|
|
std::string previewSourceLabel = {};
|
|
|
|
|
bool hostedPreviewEnabled = true;
|
|
|
|
|
bool nativeHostedPreview = false;
|
|
|
|
|
bool hasHostedSurfaceDescriptor = false;
|
|
|
|
|
bool showHostedSurfaceImage = false;
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-05 04:55:25 +08:00
|
|
|
class XCUILayoutLabPanel : public Panel {
|
|
|
|
|
public:
|
|
|
|
|
explicit XCUILayoutLabPanel(
|
2026-04-05 13:24:14 +08:00
|
|
|
::XCEngine::Editor::XCUIBackend::IXCUIInputSnapshotSource* inputSource = nullptr);
|
2026-04-05 04:55:25 +08:00
|
|
|
XCUILayoutLabPanel(
|
2026-04-05 13:24:14 +08:00
|
|
|
::XCEngine::Editor::XCUIBackend::IXCUIInputSnapshotSource* inputSource,
|
|
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIHostedPreviewPresenter> previewPresenter,
|
|
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIPanelCanvasHost> canvasHost = nullptr);
|
2026-04-05 04:55:25 +08:00
|
|
|
~XCUILayoutLabPanel() override = default;
|
|
|
|
|
|
|
|
|
|
void Render() override;
|
2026-04-05 17:41:31 +08:00
|
|
|
const XCUILayoutLabFrameComposition& ComposeFrame(
|
|
|
|
|
const XCUILayoutLabFrameCompositionRequest& request);
|
2026-04-05 04:55:25 +08:00
|
|
|
void SetHostedPreviewEnabled(bool enabled);
|
|
|
|
|
void SetHostedPreviewPresenter(
|
|
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIHostedPreviewPresenter> previewPresenter);
|
2026-04-05 12:30:03 +08:00
|
|
|
void SetCanvasHost(
|
|
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIPanelCanvasHost> canvasHost);
|
2026-04-05 04:55:25 +08:00
|
|
|
bool IsHostedPreviewEnabled() const { return m_hostedPreviewEnabled; }
|
|
|
|
|
bool IsUsingNativeHostedPreview() const;
|
|
|
|
|
const ::XCEngine::Editor::XCUIBackend::XCUILayoutLabFrameResult& GetFrameResult() const;
|
2026-04-05 17:41:31 +08:00
|
|
|
const XCUILayoutLabFrameComposition& GetLastFrameComposition() const;
|
2026-04-05 04:55:25 +08:00
|
|
|
const ::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats& GetLastPreviewStats() const;
|
2026-04-05 17:41:31 +08:00
|
|
|
bool GetLastReloadSucceeded() const { return m_lastReloadSucceeded; }
|
2026-04-05 12:53:05 +08:00
|
|
|
bool TryGetElementRect(const std::string& elementId, ::XCEngine::UI::UIRect& outRect) const;
|
2026-04-05 04:55:25 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool m_lastReloadSucceeded = false;
|
|
|
|
|
bool m_hostedPreviewEnabled = true;
|
2026-04-05 13:24:14 +08:00
|
|
|
::XCEngine::Editor::XCUIBackend::IXCUIInputSnapshotSource* m_inputSource = nullptr;
|
|
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIInputBridge m_inputBridge;
|
2026-04-05 04:55:25 +08:00
|
|
|
::XCEngine::Editor::XCUIBackend::XCUILayoutLabRuntime m_runtime;
|
|
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIHostedPreviewPresenter> m_previewPresenter;
|
2026-04-05 12:30:03 +08:00
|
|
|
std::unique_ptr<::XCEngine::Editor::XCUIBackend::IXCUIPanelCanvasHost> m_canvasHost;
|
2026-04-05 04:55:25 +08:00
|
|
|
::XCEngine::Editor::XCUIBackend::XCUIHostedPreviewStats m_lastPreviewStats = {};
|
2026-04-05 17:41:31 +08:00
|
|
|
XCUILayoutLabFrameComposition m_lastFrameComposition = {};
|
2026-04-05 04:55:25 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace NewEditor
|
|
|
|
|
} // namespace XCEngine
|