Files
XCEngine/docs/api/XCEditor/Foundation/Foundation.md

51 lines
2.4 KiB
Markdown
Raw Normal View History

# Foundation
**命名空间**: `XCEngine::UI::Editor`
**类型**: `module`
**描述**: `XCEditor` 的基础协议层,覆盖命令注册、命令派发、快捷键管理以及主题度量解析入口。
## 概览
`Foundation` 解决的是“shell 和控件真正运行前,需要先有一套什么样的 editor 级基础协议”。
按当前代码,职责主要分成四块:
- `UIEditorCommandRegistry.h`
- 定义 editor 命令描述、workspace 命令描述以及注册表校验规则。
- `UIEditorCommandDispatcher.h`
-`commandId` 解析为 workspace command 或 host command并执行 preview / dispatch。
- `UIEditorShortcutManager.h`
- 复用 `XCEngine::UI::UIShortcutRegistry` 完成快捷键绑定、冲突校验与调度。
- `UIEditorTheme.h`
-`Collections / Fields / Shell` 汇总默认 metrics / palette 解析入口。
这层不直接渲染 widget也不直接拥有 workspace 状态;它更像 `XCEditor` 的“命令 + 输入 + 主题”底座。
## 当前调用链
- `new_editor/src/Shell/UIEditorShellAsset.cpp` 会从 shell asset 构造命令注册表和快捷键管理器。
- `new_editor/src/Shell/UIEditorMenuModel.cpp` 通过命令注册表、命令派发器和快捷键管理器生成 menu item 的启用态与 shortcut 文案。
- 多组 `tests/UI/Editor/unit/**``tests/UI/Editor/integration/**` 当前直接把这层当作 editor shell 的最小可验证基础设施。
## 公开头文件
- [UIEditorCommandRegistry](UIEditorCommandRegistry/UIEditorCommandRegistry.md) - editor 命令描述与注册表校验规则。
- [UIEditorCommandDispatcher](UIEditorCommandDispatcher/UIEditorCommandDispatcher.md) - `commandId -> workspace/host dispatch` 入口。
- [UIEditorShortcutManager](UIEditorShortcutManager/UIEditorShortcutManager.md) - editor 快捷键绑定、校验和调度入口。
- [UIEditorTheme](UIEditorTheme/UIEditorTheme.md) - 默认 metrics / palette 解析入口。
## 当前实现边界
- 该模块不直接渲染 UI而是为 `Shell``Collections``Fields` 提供命令、快捷键和主题基础能力。
- 当前主题解析函数统一返回静态默认值,还没有引入动态主题切换或 style 覆盖链。
- host command 仍然通过 `UIEditorHostCommandHandler` 抽象对外,不把宿主实现细节泄漏回 public header。
## 相关文档
- [XCEditor](../XCEditor.md)
- [Shell](../Shell/Shell.md)
- [Collections](../Collections/Collections.md)
- [Fields](../Fields/Fields.md)