docs: sync api and planning docs

This commit is contained in:
2026-04-08 16:07:03 +08:00
parent 08c3278e10
commit 31756847ab
1826 changed files with 44502 additions and 29645 deletions

View File

@@ -0,0 +1,49 @@
# ContextMenu
**命名空间**: `XCEngine::Editor::UI`
**类型**: `utility-header`
**源文件**: `editor/src/UI/ContextMenu.h`
**描述**: 为 Editor 统一封装上下文菜单 popup 的样式压栈、开启/结束入口和子菜单绘制辅助。
## 概述
`ContextMenu.h` 把 Dear ImGui 原始 popup API 收束成了 Editor 统一风格的上下文菜单入口。
## 当前公开入口
- `BeginContextMenu(...)`
- `BeginContextMenuForLastItem(...)`
- `BeginContextMenuForWindow(...)`
- `EndContextMenu()`
- `DrawContextSubmenu(...)`
## 当前行为
- 进入菜单前会统一压入 popup chrome 和 context menu layout style。
- 结束菜单时会对应弹出这些样式。
- `DrawContextSubmenu(...)` 会在打开子菜单时再压入 popup content chrome。
当前还有一条很具体的产品行为:
- 当子菜单 label 为 `Create` 时,会通过 `Debug::Logger` 追踪其打开/关闭状态。
## 当前使用位置
- `HierarchyActionRouter.h`
- `ProjectPanel.cpp`
- `ConsolePanel.cpp`
- `InspectorPanel.cpp`
## 当前实现边界
- 这里统一的是 Editor 菜单风格,不是通用 menu framework。
- 依赖当前 `StyleTokens``Core.h` 里定义的 popup chrome helper。
## 相关文档
- [当前模块](../UI.md)
- [MenuCommand](../MenuCommand/MenuCommand.md)
- [Widgets](../Widgets/Widgets.md)