ECS mount point for one UI panel/screen. Subclass to attach UI to game entities, e.g. class Hud : public UIHost. UISystem walks ecs::View<UIHost, Meta, Tree> (includes subclasses).
更多...
#include <UIHost.h>
类 | |
| struct | Meta |
| Meta public API. 更多... | |
| struct | Tree |
| struct | WorldAnchor |
| Optional 3D-world projection for this UI host. 更多... | |
Public 成员函数 | |
| void | release () override |
| Entity. | |
| UIHostHandle | handle () const noexcept |
| Returns this host's generation-qualified ECS handle. | |
| void | setName (const std::string &name) |
| Names the host. | |
| const std::string & | getName () |
| void | setThemeOverride (const Theme &theme) |
| Apply a host-local Theme without mutating ui::globalTheme(). | |
| void | clearThemeOverride () |
| Stop using a host-local Theme and inherit the process global again. | |
| bool | hasThemeOverride () |
| True when a host-local Theme is installed. | |
| const Theme * | themeOverride () |
| Borrow the host-local Theme when one is installed. | |
| void | setOwnerId (uint32_t id) |
| Attaches the host to an owner id (scene/UI ownership). | |
| uint32_t | getOwnerId () |
| void | setTree (WidgetDesc root) |
| Full replace. | |
| bool | setTreeReconcile (WidgetDesc root) |
| Key-aware patch when structure matches; else full replace. | |
| void | setSimplePanel (const std::string &title, const std::string &labelText, const std::string &buttonText, const std::string &labelId="label", const std::string &buttonId="btn") |
| One-shot convenience panel: window + label + button. | |
| void | setTextById (const std::string &id, const std::string &text) |
| Widget state updates by node id. | |
| void | setVisibleById (const std::string &id, bool visible) |
| void | setEnabledById (const std::string &id, bool enabled) |
| void | setCheckedById (const std::string &id, bool checked) |
| void | setValueById (const std::string &id, float value) |
| void | setValueTextById (const std::string &id, const std::string &value) |
| bool | setClickHandler (const std::string &id, std::function< void()> fn) |
| Installs a widget callback by node id (returns false if not found). | |
| bool | setToggleHandler (const std::string &id, std::function< void(bool)> fn) |
| bool | setValueHandler (const std::string &id, std::function< void(float)> fn) |
| bool | setTextHandler (const std::string &id, std::function< void(const std::string &)> fn) |
| eve::OptionalRef< UINode > | findById (const std::string &id) |
| Looks up a node by stable id without transferring ownership. | |
| eve::OptionalRef< UINode > | findByKey (const std::string &key) |
| Looks up a node by reconciliation key without transferring ownership. | |
| bool | requestFocusById (const std::string &id) |
| Request keyboard/gamepad focus for a control on the next frame. | |
| bool | moveFocus (FocusDirection direction, bool wrap=true) |
| Move through explicit neighbors or deterministic tab order. | |
| std::string | focusedId () |
| Return the currently focused control id, or an empty string. | |
| void | markDirty () |
| Marks the tree for a full rebuild on the next frame. | |
| void | setVisible (bool v) |
| Host visibility / layer / modality. | |
| void | setLayer (int layer) |
| void | setModal (bool modal) |
| void | setWorldAnchor (float x, float y, float z) |
| Enables projection of this host from a 3D world point. | |
| void | clearWorldAnchor () |
| Disables 3D projection and returns the host to normal screen layout. | |
静态 Public 成员函数 | |
| static UIHostHandle | createHost (const std::string &name="") |
| Creates an ECS-owned UI host. | |
| static eve::OptionalRef< UIHost > | resolve (UIHostHandle handle) noexcept |
| Resolves a UI host handle with ECS generation checking. | |
详细描述
ECS mount point for one UI panel/screen. Subclass to attach UI to game entities, e.g. class Hud : public UIHost. UISystem walks ecs::View<UIHost, Meta, Tree> (includes subclasses).
成员函数说明
◆ clearThemeOverride()
| void eve::ui::UIHost::clearThemeOverride | ( | ) |
Stop using a host-local Theme and inherit the process global again.
在文件 UIHost.cpp 第 76 行定义.
◆ clearWorldAnchor()
| void eve::ui::UIHost::clearWorldAnchor | ( | ) |
Disables 3D projection and returns the host to normal screen layout.
在文件 UIHost.cpp 第 92 行定义.
引用了 anchor , 以及 eve::ui::Disabled.
◆ createHost()
|
static |
Creates an ECS-owned UI host.
- 返回
- A generation-checked handle; an empty handle means creation failed. @ownership The UI ECS world owns the host; callers must not delete it. @lifetime The handle is valid until ECS destruction or UI module teardown; resolve it at each use. @thread Call on the UI ECS thread. @reentrancy The factory invokes no external callbacks.
在文件 UIHost.cpp 第 48 行定义.
被这些函数引用 eve::ui::Component::mountAs(), eve::ui::UI::mountAs(), eve::pixelworld_editor::PixelWorldCatalogPanel::open(), eve::ui::DatabasePanel::open(), eve::ui::Inspector::open(), eve::ui::ScenePanel::open(), eve::ui::EditorShell::open() , 以及 eve::ui::UI::remountBuildAs().
◆ findById()
| eve::OptionalRef< UINode > eve::ui::UIHost::findById | ( | const std::string & | id | ) |
Looks up a node by stable id without transferring ownership.
- 返回
- Borrowed nullable node owned by this host's tree. @ownership UIHost owns the node tree; callers must not delete the result. @lifetime Valid until the next tree replacement/reconcile or host destruction. @thread Call on the UI thread owning this host. @reentrancy Do not retain across callbacks or tree mutation.
在文件 UIHost.cpp 第 114 行定义.
被这些函数引用 moveFocus(), requestFocusById(), setCheckedById(), setClickHandler(), setEnabledById(), setTextById(), setTextHandler(), setToggleHandler(), setValueById(), setValueHandler(), setValueTextById() , 以及 setVisibleById().
◆ findByKey()
| eve::OptionalRef< UINode > eve::ui::UIHost::findByKey | ( | const std::string & | key | ) |
Looks up a node by reconciliation key without transferring ownership.
- 返回
- Borrowed nullable node owned by this host's tree. @ownership UIHost owns the node tree; callers must not delete the result. @lifetime Valid until the next tree replacement/reconcile or host destruction. @thread Call on the UI thread owning this host. @reentrancy Do not retain across callbacks or tree mutation.
在文件 UIHost.cpp 第 123 行定义.
◆ focusedId()
| std::string eve::ui::UIHost::focusedId | ( | ) |
Return the currently focused control id, or an empty string.
在文件 UIHost.cpp 第 224 行定义.
◆ getName()
| const std::string & eve::ui::UIHost::getName | ( | ) |
在文件 UIHost.cpp 第 69 行定义.
◆ getOwnerId()
◆ handle()
|
inlinenoexcept |
Returns this host's generation-qualified ECS handle.
- 返回
- A handle that becomes stale when this host is destroyed or replaced.
被这些函数引用 createHost().
◆ hasThemeOverride()
| bool eve::ui::UIHost::hasThemeOverride | ( | ) |
True when a host-local Theme is installed.
在文件 UIHost.cpp 第 78 行定义.
◆ markDirty()
|
inline |
◆ moveFocus()
| bool eve::ui::UIHost::moveFocus | ( | FocusDirection | direction, |
| bool | wrap = true |
||
| ) |
Move through explicit neighbors or deterministic tab order.
- 参数
-
direction Logical sequential or directional movement. wrap Whether sequential fallback wraps at the first/last control.
在文件 UIHost.cpp 第 171 行定义.
引用了 current, direction, findById(), found, index, eve::ui::Left, node, order, position, eve::ui::Previous, requestFocusById(), t , 以及 eve::ui::Up.
◆ release()
◆ requestFocusById()
| bool eve::ui::UIHost::requestFocusById | ( | const std::string & | id | ) |
Request keyboard/gamepad focus for a control on the next frame.
在文件 UIHost.cpp 第 162 行定义.
引用了 findById(), node, t , 以及 target.
被这些函数引用 moveFocus().
◆ resolve()
|
staticnoexcept |
Resolves a UI host handle with ECS generation checking.
- 参数
-
handle Candidate host handle.
- 返回
- A temporary borrowed host for the current UI operation, or null when stale. @ownership The UI ECS world owns the returned host; callers must not delete it. @lifetime Valid only until the next UI ECS structural mutation or world teardown. @thread Call on the UI ECS thread. @reentrancy Does not invoke callbacks; do not retain the returned pointer across frames.
在文件 UIHost.cpp 第 61 行定义.
被这些函数引用 eve::ui::UiTweenDriver::animateHostOverlayAlpha(), eve::ui::UiTweenDriver::animateHostPos(), eve::ui::UiTweenDriver::animateHostSize(), eve::ui::UiTweenDriver::animateItemOpacity(), eve::ui::UiTweenDriver::animateItemPos(), eve::ui_editor::UiThemeEditor::applyPreviewHost(), eve::pixelworld_editor::PixelWorldCatalogPanel::close(), eve::ui::DatabasePanel::close(), eve::ui::Inspector::close(), eve::ui::ScenePanel::close(), eve::ui::UI::dispatchEvents(), eve::ui::UISystem::dispatchEvents(), eve::ui::UISystem::findHost(), eve::ui::UISystem::findHostByOwner(), eve::pixelworld_editor::PixelWorldCatalogPanel::isOpen(), eve::ui::DatabasePanel::isOpen(), eve::ui::EditorShell::isOpen(), eve::ui::Inspector::isOpen(), eve::ui::ScenePanel::isOpen(), eve::ui::Component::mountAs(), eve::ui::UI::mountAs(), eve::ui::UI::mountBuild(), eve::ui::UI::mountBuildAs(), eve::ui::UI::mountSimple(), eve::pixelworld_editor::PixelWorldCatalogPanel::open(), eve::ui::DatabasePanel::open(), eve::ui::Inspector::open(), eve::ui::ScenePanel::open(), eve::ui::EditorShell::open(), eve::pixelworld_editor::PixelWorldCatalogPanel::operator=(), eve::ui::Component::rebuild(), eve::pixelworld_editor::PixelWorldCatalogPanel::refresh(), eve::ui::ScenePanel::refresh(), eve::ui::UI::remount(), eve::ui::UI::remountBuildAs(), eve::ui::UI::remountReconcile(), eve::ui::UISystem::render(), eve::ui::UI::select(), eve::ui::EditorShell::selectPanel(), eve::ui::Inspector::sync(), eve::ui::UiTweenDriver::tick(), eve::ui::EditorShell::togglePanel(), eve::ui::Component::updateIfDirty(), eve::ui::UiHostPosSink::write(), eve::ui::UiHostSizeSink::write(), eve::ui::UiNodePosSink::write(), eve::ui::UiHostOverlayAlphaSink::write(), eve::ui::UiNodeOpacitySink::write(), eve::ui::DatabasePanel::~DatabasePanel(), eve::ui::EditorShell::~EditorShell(), eve::ui::Inspector::~Inspector(), eve::pixelworld_editor::PixelWorldCatalogPanel::~PixelWorldCatalogPanel() , 以及 eve::ui::ScenePanel::~ScenePanel().
◆ setCheckedById()
| void eve::ui::UIHost::setCheckedById | ( | const std::string & | id, |
| bool | checked | ||
| ) |
在文件 UIHost.cpp 第 150 行定义.
引用了 findById() , 以及 n.
◆ setClickHandler()
| bool eve::ui::UIHost::setClickHandler | ( | const std::string & | id, |
| std::function< void()> | fn | ||
| ) |
Installs a widget callback by node id (returns false if not found).
在文件 UIHost.cpp 第 232 行定义.
引用了 findById(), fn, idx, n , 以及 t.
◆ setEnabledById()
| void eve::ui::UIHost::setEnabledById | ( | const std::string & | id, |
| bool | enabled | ||
| ) |
在文件 UIHost.cpp 第 140 行定义.
引用了 enabled, findById() , 以及 n.
◆ setLayer()
◆ setModal()
◆ setName()
| void eve::ui::UIHost::setName | ( | const std::string & | name | ) |
◆ setOwnerId()
|
inline |
◆ setSimplePanel()
| void eve::ui::UIHost::setSimplePanel | ( | const std::string & | title, |
| const std::string & | labelText, | ||
| const std::string & | buttonText, | ||
| const std::string & | labelId = "label", |
||
| const std::string & | buttonId = "btn" |
||
| ) |
One-shot convenience panel: window + label + button.
在文件 UIHost.cpp 第 103 行定义.
引用了 eve::ui::button(), setTree(), text, title , 以及 eve::ui::window().
◆ setTextById()
| void eve::ui::UIHost::setTextById | ( | const std::string & | id, |
| const std::string & | text | ||
| ) |
◆ setTextHandler()
| bool eve::ui::UIHost::setTextHandler | ( | const std::string & | id, |
| std::function< void(const std::string &)> | fn | ||
| ) |
在文件 UIHost.cpp 第 280 行定义.
引用了 findById(), fn, idx, n , 以及 t.
◆ setThemeOverride()
| void eve::ui::UIHost::setThemeOverride | ( | const Theme & | theme | ) |
Apply a host-local Theme without mutating ui::globalTheme().
- 参数
-
theme Copied design tokens used while measuring and rendering this host. @ownership This host stores a copy. Callers retain the argument.
在文件 UIHost.cpp 第 71 行定义.
引用了 theme.
◆ setToggleHandler()
| bool eve::ui::UIHost::setToggleHandler | ( | const std::string & | id, |
| std::function< void(bool)> | fn | ||
| ) |
在文件 UIHost.cpp 第 248 行定义.
引用了 findById(), fn, idx, n , 以及 t.
◆ setTree()
| void eve::ui::UIHost::setTree | ( | WidgetDesc | root | ) |
Full replace.
在文件 UIHost.cpp 第 99 行定义.
引用了 eve::ui::applyTree() , 以及 root.
被这些函数引用 eve::ui::EditorShell::open() , 以及 setSimplePanel().
◆ setTreeReconcile()
| bool eve::ui::UIHost::setTreeReconcile | ( | WidgetDesc | root | ) |
Key-aware patch when structure matches; else full replace.
在文件 UIHost.cpp 第 101 行定义.
引用了 eve::ui::applyTreeReconcile() , 以及 root.
◆ setValueById()
| void eve::ui::UIHost::setValueById | ( | const std::string & | id, |
| float | value | ||
| ) |
在文件 UIHost.cpp 第 154 行定义.
引用了 findById(), n , 以及 value.
◆ setValueHandler()
| bool eve::ui::UIHost::setValueHandler | ( | const std::string & | id, |
| std::function< void(float)> | fn | ||
| ) |
在文件 UIHost.cpp 第 264 行定义.
引用了 findById(), fn, idx, n , 以及 t.
◆ setValueTextById()
| void eve::ui::UIHost::setValueTextById | ( | const std::string & | id, |
| const std::string & | value | ||
| ) |
在文件 UIHost.cpp 第 158 行定义.
引用了 findById(), n , 以及 value.
◆ setVisible()
|
inline |
◆ setVisibleById()
| void eve::ui::UIHost::setVisibleById | ( | const std::string & | id, |
| bool | visible | ||
| ) |
在文件 UIHost.cpp 第 136 行定义.
引用了 findById(), n , 以及 visible.
◆ setWorldAnchor()
| void eve::ui::UIHost::setWorldAnchor | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
◆ themeOverride()
| const Theme * eve::ui::UIHost::themeOverride | ( | ) |
Borrow the host-local Theme when one is installed.
- 返回
- Pointer owned by this host, or null. @lifetime Valid until the next override mutation or host destruction.
在文件 UIHost.cpp 第 80 行定义.
该类的文档由以下文件生成:
- src/modules/ui/UIHost.h
- src/modules/ui/UIHost.cpp