Refactor XCUI editor module layout

This commit is contained in:
2026-04-10 00:41:28 +08:00
parent 4b47764f26
commit 02a0e626fe
263 changed files with 12396 additions and 7592 deletions

View File

@@ -0,0 +1,73 @@
#pragma once
#include <XCEditor/Foundation/UIEditorCommandRegistry.h>
#include <cstdint>
#include <string>
#include <string_view>
namespace XCEngine::UI::Editor {
enum class UIEditorCommandEvaluationCode : std::uint8_t {
None = 0,
InvalidCommandRegistry,
UnknownCommandId,
MissingActivePanel
};
struct UIEditorCommandEvaluationResult {
UIEditorCommandEvaluationCode code = UIEditorCommandEvaluationCode::None;
bool executable = false;
std::string commandId = {};
std::string displayName = {};
UIEditorWorkspaceCommand workspaceCommand = {};
UIEditorWorkspaceCommandResult previewResult = {};
std::string message = {};
[[nodiscard]] bool IsExecutable() const {
return executable;
}
};
enum class UIEditorCommandDispatchStatus : std::uint8_t {
Dispatched = 0,
Rejected
};
struct UIEditorCommandDispatchResult {
UIEditorCommandDispatchStatus status = UIEditorCommandDispatchStatus::Rejected;
bool commandExecuted = false;
std::string commandId = {};
std::string displayName = {};
UIEditorWorkspaceCommand workspaceCommand = {};
UIEditorWorkspaceCommandResult commandResult = {};
std::string message = {};
};
std::string_view GetUIEditorCommandDispatchStatusName(
UIEditorCommandDispatchStatus status);
class UIEditorCommandDispatcher {
public:
UIEditorCommandDispatcher() = default;
explicit UIEditorCommandDispatcher(UIEditorCommandRegistry commandRegistry);
const UIEditorCommandRegistry& GetCommandRegistry() const {
return m_commandRegistry;
}
UIEditorCommandRegistryValidationResult ValidateConfiguration() const;
UIEditorCommandEvaluationResult Evaluate(
std::string_view commandId,
const UIEditorWorkspaceController& controller) const;
UIEditorCommandDispatchResult Dispatch(
std::string_view commandId,
UIEditorWorkspaceController& controller) const;
private:
UIEditorCommandRegistry m_commandRegistry = {};
};
} // namespace XCEngine::UI::Editor