关键节点
This commit is contained in:
70
editor/include/XCEditor/Foundation/UIEditorCommandRegistry.h
Normal file
70
editor/include/XCEditor/Foundation/UIEditorCommandRegistry.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Workspace/UIEditorWorkspaceController.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace XCEngine::UI::Editor {
|
||||
|
||||
enum class UIEditorCommandKind : std::uint8_t {
|
||||
Workspace = 0,
|
||||
Host
|
||||
};
|
||||
|
||||
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 = {};
|
||||
UIEditorCommandKind kind = UIEditorCommandKind::Workspace;
|
||||
};
|
||||
|
||||
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);
|
||||
std::string_view GetUIEditorCommandKindName(UIEditorCommandKind kind);
|
||||
|
||||
const UIEditorCommandDescriptor* FindUIEditorCommandDescriptor(
|
||||
const UIEditorCommandRegistry& registry,
|
||||
std::string_view commandId);
|
||||
|
||||
UIEditorCommandRegistryValidationResult ValidateUIEditorCommandRegistry(
|
||||
const UIEditorCommandRegistry& registry);
|
||||
|
||||
} // namespace XCEngine::UI::Editor
|
||||
Reference in New Issue
Block a user