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 |
| struct | Tree |
Public 成员函数 | |
| void | release () override |
| void | setName (const std::string &name) |
| Names the host. | |
| const std::string & | getName () |
| 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 | 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) |
| UINode * | findById (const std::string &id) |
| Looks up a node by id or reconciliation key. | |
| UINode * | findByKey (const std::string &key) |
| 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) |
静态 Public 成员函数 | |
| static UIHost * | createHost (const std::string &name="") |
详细描述
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).
成员函数说明
◆ createHost()
|
static |
在文件 UIHost.cpp 第 11 行定义.
被这些函数引用 eve::ui::Component::mountAs(), eve::ui::UI::mountAs() , 以及 eve::ui::UI::remountBuildAs().
◆ findById()
| UINode * eve::ui::UIHost::findById | ( | const std::string & | id | ) |
Looks up a node by id or reconciliation key.
在文件 UIHost.cpp 第 41 行定义.
引用了 n.
被这些函数引用 eve::ui::UI::getChecked(), eve::ui::UI::getValue(), eve::ui::UI::getValueText(), setCheckedById(), setClickHandler(), eve::ui::UI::setImageCornerRadius(), eve::ui::UI::setImageNinePatch(), eve::ui::UI::setImageTextureId(), eve::ui::UI::setImageTint(), eve::ui::UI::setImageUv(), eve::ui::UI::setListItems(), setTextById(), setTextHandler(), eve::ui::UI::setTextWrap(), setToggleHandler(), setValueById(), setValueHandler(), setValueTextById() , 以及 setVisibleById().
◆ findByKey()
| UINode * eve::ui::UIHost::findByKey | ( | const std::string & | key | ) |
在文件 UIHost.cpp 第 50 行定义.
引用了 n.
◆ getName()
| const std::string & eve::ui::UIHost::getName | ( | ) |
在文件 UIHost.cpp 第 24 行定义.
被这些函数引用 eve::ui::UI::onChange(), eve::ui::UI::onClick(), eve::ui::UI::saveTreeJson(), eve::ui::UI::setListItems(), eve::ui::UI::viewportActive(), eve::ui::UI::viewportCanvas(), eve::ui::UI::viewportDragDX(), eve::ui::UI::viewportDragDY(), eve::ui::UI::viewportHovered(), eve::ui::UI::viewportMouseX(), eve::ui::UI::viewportMouseY() , 以及 eve::ui::UI::viewportWheel().
◆ getOwnerId()
◆ markDirty()
|
inline |
◆ release()
◆ setCheckedById()
| void eve::ui::UIHost::setCheckedById | ( | const std::string & | id, |
| bool | checked | ||
| ) |
◆ 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 第 79 行定义.
引用了 findById(), fn, idx , 以及 n.
◆ setLayer()
|
inline |
◆ setModal()
|
inline |
被这些函数引用 eve::ui::UI::setHostModal().
◆ 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 第 30 行定义.
引用了 eve::ui::button(), setTree(), eve::ui::text(), title , 以及 eve::ui::window().
◆ setTextById()
| void eve::ui::UIHost::setTextById | ( | const std::string & | id, |
| const std::string & | text | ||
| ) |
Widget state updates by node id.
在文件 UIHost.cpp 第 59 行定义.
引用了 findById(), n , 以及 eve::ui::text().
被这些函数引用 eve::ui::UI::setText().
◆ setTextHandler()
| bool eve::ui::UIHost::setTextHandler | ( | const std::string & | id, |
| std::function< void(const std::string &)> | fn | ||
| ) |
在文件 UIHost.cpp 第 127 行定义.
引用了 findById(), fn, idx , 以及 n.
◆ setToggleHandler()
| bool eve::ui::UIHost::setToggleHandler | ( | const std::string & | id, |
| std::function< void(bool)> | fn | ||
| ) |
在文件 UIHost.cpp 第 95 行定义.
引用了 findById(), fn, idx , 以及 n.
◆ setTree()
| void eve::ui::UIHost::setTree | ( | WidgetDesc | root | ) |
Full replace.
在文件 UIHost.cpp 第 26 行定义.
引用了 eve::ui::applyTree().
被这些函数引用 eve::ui::UI::loadTreeJson(), eve::ui::UI::mount(), eve::ui::Component::rebuild(), eve::ui::UI::setListItems() , 以及 setSimplePanel().
◆ setTreeReconcile()
| bool eve::ui::UIHost::setTreeReconcile | ( | WidgetDesc | root | ) |
Key-aware patch when structure matches; else full replace.
在文件 UIHost.cpp 第 28 行定义.
引用了 eve::ui::applyTreeReconcile().
被这些函数引用 eve::ui::Component::rebuild() , 以及 eve::ui::UI::setListItems().
◆ setValueById()
| void eve::ui::UIHost::setValueById | ( | const std::string & | id, |
| float | value | ||
| ) |
◆ setValueHandler()
| bool eve::ui::UIHost::setValueHandler | ( | const std::string & | id, |
| std::function< void(float)> | fn | ||
| ) |
在文件 UIHost.cpp 第 111 行定义.
引用了 findById(), fn, idx , 以及 n.
◆ setValueTextById()
| void eve::ui::UIHost::setValueTextById | ( | const std::string & | id, |
| const std::string & | value | ||
| ) |
◆ setVisible()
|
inline |
◆ setVisibleById()
| void eve::ui::UIHost::setVisibleById | ( | const std::string & | id, |
| bool | visible | ||
| ) |
在文件 UIHost.cpp 第 63 行定义.
引用了 findById(), n , 以及 eve::ui::WidgetDesc::visible.
被这些函数引用 eve::ui::UI::setVisible().
该类的文档由以下文件生成:
- src/modules/ui/UIHost.h
- src/modules/ui/UIHost.cpp