声明式UI管理器 更多...
#include <UI.h>
Public 成员函数 | |
| ~DeclarativeUIManager () | |
| void | addBlock (const std::string &name, Block *block) |
| 添加UI块 | |
| Block * | findBlock (const std::string &name) |
| 查找UI块 | |
| std::string | findBlockByName (const Block *block) const |
| 查找UI块名称 | |
| void | removeBlock (const std::string &name) |
| 移除UI块 | |
| void | replaceBlock (const std::string &name, Block *block) |
| 替换UI块 | |
静态 Public 成员函数 | |
| static DeclarativeUIManager & | getInstance () |
| 获取UI管理器实例 | |
声明式UI管理器
管理所有声明式UI块,并提供查找和添加和统一析构的功能
| GFt::DeclarativeUIManager::~DeclarativeUIManager | ( | ) |
| void GFt::DeclarativeUIManager::addBlock | ( | const std::string & | name, |
| Block * | block ) |
添加UI块
| name | 块名称 |
| block | 块指针 |
所有通过此方法添加的块都会被包装为std::unique_ptr,并自动管理生命周期 因此,不需要再手动delete块
| 块名称不能重复,如果名称已存在,则会抛出异常 |
| Block * GFt::DeclarativeUIManager::findBlock | ( | const std::string & | name | ) |
查找UI块
| name | 块名称 |
| std::string GFt::DeclarativeUIManager::findBlockByName | ( | const Block * | block | ) | const |
查找UI块名称
| block | 块指针 |
|
static |
获取UI管理器实例
| void GFt::DeclarativeUIManager::removeBlock | ( | const std::string & | name | ) |
移除UI块
| name | 块名称 |
如果名称不存在,则不会有任何操作
| void GFt::DeclarativeUIManager::replaceBlock | ( | const std::string & | name, |
| Block * | block ) |
替换UI块
| name | 块名称 |
| block | 新的块指针 |
如果名称不存在,则会自动添加;如果名称已存在,则会自动替换