Files
XCEngine/new_editor/app/Commands/EditorHostCommandBridge.h

64 lines
2.6 KiB
C++

#pragma once
#include "Commands/EditorEditCommandRoute.h"
#include "State/EditorCommandFocusService.h"
#include "State/EditorSession.h"
#include <XCEditor/Foundation/UIEditorCommandDispatcher.h>
#include <functional>
#include <string_view>
namespace XCEngine::UI::Editor::App {
class EditorHostCommandBridge : public UIEditorHostCommandHandler {
public:
void BindSession(EditorSession& session);
void BindCommandFocusService(const EditorCommandFocusService& commandFocusService);
void BindEditCommandRoutes(
EditorEditCommandRoute* hierarchyRoute,
EditorEditCommandRoute* projectRoute,
EditorEditCommandRoute* sceneRoute = nullptr,
EditorEditCommandRoute* inspectorRoute = nullptr);
void SetExitRequestHandler(std::function<void()> handler);
UIEditorHostCommandEvaluationResult EvaluateHostCommand(
std::string_view commandId) const override;
UIEditorHostCommandDispatchResult DispatchHostCommand(
std::string_view commandId) override;
private:
UIEditorHostCommandEvaluationResult BuildDisabledResult(
std::string_view message) const;
UIEditorHostCommandEvaluationResult BuildExecutableResult(
std::string_view message) const;
UIEditorHostCommandEvaluationResult EvaluateFileCommand(
std::string_view commandId) const;
UIEditorHostCommandEvaluationResult EvaluateAssetCommand(
std::string_view commandId) const;
UIEditorHostCommandEvaluationResult EvaluateRunCommand(
std::string_view commandId) const;
UIEditorHostCommandEvaluationResult EvaluateScriptCommand(
std::string_view commandId) const;
UIEditorHostCommandEvaluationResult EvaluateEditCommand(
std::string_view commandId) const;
UIEditorHostCommandDispatchResult DispatchAssetCommand(
std::string_view commandId);
UIEditorHostCommandDispatchResult DispatchEditCommand(
std::string_view commandId);
UIEditorHostCommandEvaluationResult EvaluateUnsupportedHostCommand(
std::string_view commandId) const;
EditorActionRoute ResolveActiveEditRoute() const;
EditorEditCommandRoute* ResolveEditCommandRoute(EditorActionRoute route) const;
EditorSession* m_session = nullptr;
const EditorCommandFocusService* m_commandFocusService = nullptr;
EditorEditCommandRoute* m_hierarchyRoute = nullptr;
EditorEditCommandRoute* m_projectRoute = nullptr;
EditorEditCommandRoute* m_sceneRoute = nullptr;
EditorEditCommandRoute* m_inspectorRoute = nullptr;
std::function<void()> m_requestExit = {};
};
} // namespace XCEngine::UI::Editor::App