Files
XCEngine/docs/api/XCEngine/Editor/UI/PanelChrome/PanelChrome.md

1.2 KiB
Raw Blame History

PanelChrome

命名空间: XCEngine::Editor::UI

类型: header-helper

源文件: editor/src/UI/PanelChrome.h

描述: 提供编辑器面板窗口、工具栏和内容区的 RAII 外壳。

概述

PanelChrome.h 让各个面板可以用统一方式搭建三段式结构:

  • PanelWindowScope
  • PanelToolbarScope
  • PanelContentScope

这几乎就是当前编辑器所有面板的“标准壳层”。

当前实现

  • 三个 scope 都在构造时 Begin在析构时 End
  • 会统一应用窗口 padding、工具栏背景色、item spacing 等样式
  • PanelToolbarScope 还会在退出时绘制底部分隔线

HierarchyPanelProjectPanelConsolePanelInspectorPanel 当前实现看,这套壳层已经成为面板 UI 的主路径。

设计说明

这是很典型的商业编辑器代码组织方式:
先把窗口 chrome 标准化,再让具体面板只关心业务内容。

收益非常直接:

  • 面板外观一致
  • Begin/End 对称性更安全
  • 工具栏和内容区的布局约束自然统一

相关文档