feat(gpui_widgets): add menu bar, context menu and modal dialog framework

W2 of the oak task list. A pure menu model (nesting, disabled items,
separators, checked state, wrap-around keyboard navigation arithmetic) feeds
two views: a MenuBar with drop-down popups and a right-click ContextMenu,
both built on anchored+deferred with keyboard navigation (up/down/enter/
escape), hover-opened submenus, check marks, shortcut labels and request
events. The Modal framework provides the mask, title bar, content slot and
button row with escape/enter defaults; message_box (info/warning/error),
progress_dialog (driven by ProgressContent) and file_dialog (native gpui
fallback - the fork has no prompt_for_paths platform API) are built on it.
A menus_dialogs example demonstrates everything. 79 tests pass.
This commit is contained in:
2026-08-09 05:33:29 +08:00
parent 4a92ab13d8
commit d72d2e8210
10 changed files with 1815 additions and 4 deletions
+7 -4
View File
@@ -38,15 +38,18 @@
位置:`crates/gpui_widgets/`(或独立 `gpui_dialogs`)。
- [ ] `ContextMenu`/`MenuBar` 窗口内菜单组件(Zed 的菜单在 zed app
- [x] `ContextMenu`/`MenuBar` 窗口内菜单组件(Zed 的菜单在 zed app
crate 而非 gpui,需要自带):弹层定位、键盘导航、子菜单、勾选/
禁用态、快捷键展示。
- [ ] `Modal` 对话框框架:模态遮罩、标题栏、按钮行(确定/取消/
- [x] `Modal` 对话框框架:模态遮罩、标题栏、按钮行(确定/取消/
应用)、Esc/Enter 默认键、尺寸约束。
- [ ] 常用对话框原语:消息框(info/warning/error 三档)、文件选择
- [x] 常用对话框原语:消息框(info/warning/error 三档)、文件选择
(包 `prompt_for_paths`/`prompt_for_new_path` 平台 API)、进度条
对话框(可取消)。
- [ ] 单测:菜单模型(勾选/禁用/级联)、对话框结果路由。
> 注:本 fork 尚无 `prompt_for_paths`/`prompt_for_new_path` 平台
> API(已核实 window/platform 均无),文件对话框先用纯 gpui 模态 +
> 路径输入框实现;后续接入真实平台选择器时替换内容即可。
- [x] 单测:菜单模型(勾选/禁用/级联)、对话框结果路由。
## W3. macOS 视频帧桥接(关键路径)