Files
XCEngine/new_editor/include/XCEditor/Foundation/UIEditorCommandRegistry.h

64 lines
1.7 KiB
C
Raw Normal View History

#pragma once
2026-04-10 00:41:28 +08:00
#include <XCEditor/Shell/UIEditorWorkspaceController.h>
#include <cstdint>
#include <string>
#include <string_view>
#include <vector>
namespace XCEngine::UI::Editor {
enum class UIEditorCommandPanelSource : std::uint8_t {
None = 0,
FixedPanelId,
ActivePanel
};
struct UIEditorWorkspaceCommandDescriptor {
UIEditorWorkspaceCommandKind kind = UIEditorWorkspaceCommandKind::ActivatePanel;
UIEditorCommandPanelSource panelSource = UIEditorCommandPanelSource::FixedPanelId;
std::string panelId = {};
};
struct UIEditorCommandDescriptor {
std::string commandId = {};
std::string displayName = {};
UIEditorWorkspaceCommandDescriptor workspaceCommand = {};
};
struct UIEditorCommandRegistry {
std::vector<UIEditorCommandDescriptor> commands = {};
};
enum class UIEditorCommandRegistryValidationCode : std::uint8_t {
None = 0,
EmptyCommandId,
EmptyDisplayName,
DuplicateCommandId,
MissingPanelSource,
MissingFixedPanelId,
UnexpectedPanelSource
};
struct UIEditorCommandRegistryValidationResult {
UIEditorCommandRegistryValidationCode code =
UIEditorCommandRegistryValidationCode::None;
std::string message = {};
[[nodiscard]] bool IsValid() const {
return code == UIEditorCommandRegistryValidationCode::None;
}
};
std::string_view GetUIEditorCommandPanelSourceName(UIEditorCommandPanelSource source);
const UIEditorCommandDescriptor* FindUIEditorCommandDescriptor(
const UIEditorCommandRegistry& registry,
std::string_view commandId);
UIEditorCommandRegistryValidationResult ValidateUIEditorCommandRegistry(
const UIEditorCommandRegistry& registry);
} // namespace XCEngine::UI::Editor