载入中...
搜索中...
未找到

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>

类 eve::ui::UIHost 继承关系图:

类

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).

在文件 UIHost.h 第 243 行定义.

成员函数说明

◆ 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()

UIHostHandle eve::ui::UIHost::createHost ( const std::string &  name = "")
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 行定义.

引用了 h, handle() , 以及 name.

被这些函数引用 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 行定义.

引用了 n , 以及 t.

被这些函数引用 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 行定义.

引用了 key, n , 以及 t.

◆ focusedId()

std::string eve::ui::UIHost::focusedId ( )

Return the currently focused control id, or an empty string.

在文件 UIHost.cpp 第 224 行定义.

引用了 node , 以及 t.

◆ getName()

const std::string & eve::ui::UIHost::getName ( )

在文件 UIHost.cpp 第 69 行定义.

◆ getOwnerId()

uint32_t eve::ui::UIHost::getOwnerId ( )
inline

在文件 UIHost.h 第 387 行定义.

◆ handle()

UIHostHandle eve::ui::UIHost::handle ( ) const
inlinenoexcept

Returns this host's generation-qualified ECS handle.

返回
A handle that becomes stale when this host is destroyed or replaced.

在文件 UIHost.h 第 364 行定义.

被这些函数引用 createHost().

◆ hasThemeOverride()

bool eve::ui::UIHost::hasThemeOverride ( )

True when a host-local Theme is installed.

在文件 UIHost.cpp 第 78 行定义.

◆ markDirty()

void eve::ui::UIHost::markDirty ( )
inline

Marks the tree for a full rebuild on the next frame.

在文件 UIHost.h 第 440 行定义.

◆ moveFocus()

bool eve::ui::UIHost::moveFocus ( FocusDirection  direction,
bool  wrap = true 
)

Move through explicit neighbors or deterministic tab order.

参数
directionLogical sequential or directional movement.
wrapWhether 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()

void eve::ui::UIHost::release ( )
inlineoverride

Entity.

Release.

在文件 UIHost.h 第 249 行定义.

◆ 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()

eve::OptionalRef< UIHost > eve::ui::UIHost::resolve ( UIHostHandle  handle)
staticnoexcept

Resolves a UI host handle with ECS generation checking.

参数
handleCandidate 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 行定义.

引用了 handle , 以及 host.

被这些函数引用 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()

void eve::ui::UIHost::setLayer ( int  layer)
inline

在文件 UIHost.h 第 444 行定义.

引用了 layer.

◆ setModal()

void eve::ui::UIHost::setModal ( bool  modal)
inline

在文件 UIHost.h 第 445 行定义.

◆ setName()

void eve::ui::UIHost::setName ( const std::string &  name)

Names the host.

在文件 UIHost.cpp 第 67 行定义.

引用了 name.

◆ setOwnerId()

void eve::ui::UIHost::setOwnerId ( uint32_t  id)
inline

Attaches the host to an owner id (scene/UI ownership).

在文件 UIHost.h 第 386 行定义.

引用了 id.

◆ 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 
)

Widget state updates by node id.

在文件 UIHost.cpp 第 132 行定义.

引用了 findById(), n , 以及 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().

参数
themeCopied 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()

void eve::ui::UIHost::setVisible ( bool  v)
inline

Host visibility / layer / modality.

在文件 UIHost.h 第 443 行定义.

引用了 v.

被这些函数引用 eve::ui::EditorShell::togglePanel().

◆ 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 
)

Enables projection of this host from a 3D world point.

参数
xWorld X coordinate.
yWorld Y coordinate.
zWorld Z coordinate.

在文件 UIHost.cpp 第 84 行定义.

引用了 anchor, x, y , 以及 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 行定义.


该类的文档由以下文件生成: