15#ifndef DL_DISABLE_RENDER
50 _fnSetPosition = func;
69 _delete_panel_child(_panel);
72 const TreeNode* p = tree.
GetRoot();
75 std::function<void(
const TreeNode*,
UI::Panel* parent)> fn_refresh =
76 [&](
const TreeNode* node,
UI::Panel* parent) {
80 _set_panel_parent(panel, parent);
81 cb(panel, node->GetValue());
83 const std::vector<TreeNode*>& vec = node->GetChild();
85 for (
const TreeNode* child : node->GetChild())
87 fn_refresh(child, panel);
90 fn_refresh(p, _panel);
99 return _panel->IsPickup();
141 _panel->SetSize(size);
142 _cptElemData._size = size;
173 void _delete_this() {
delete this; }
177 _cptDeleteThis = std::bind(&Tree::_delete_this,
this);
178 _cptSetOrder = std::bind(&
Tree::SetOrder,
this, std::placeholders::_1);
193 void _set_panel_parent(UI::Panel* panel, UI::Panel* parent);
194 void _delete_panel_child(UI::Panel* panel);
void PushBack(AnyType any)
添加一个任意对象
const Node * GetRoot() const
返回根节点,空树返回空
void SetAutoRun(bool auto_run)
设置是否自动执行
std::size_t IsSelectChange()
选中状态变更
static Tree * Create(Panel *item)
创建列表框
std::size_t GetSelectIndex()
返回选中下标
std::function< void(UI::Panel *panel, size_t y, size_t extra)> CbSetPosition
Panel * GetSelect()
返回选中元素
void SetCallbackSetPosition(CbSetPosition func)
设置位置回调
void SetSize(const Position &size)
设置大小
void Refresh(const NTree< T > &tree, CbSetContent< T > cb)
按树构建ui
std::function< void(UI::Panel *panel, const T &v)> CbSetContent
void SetOrder(float order)
设置绘制顺序
Function< std::function< void(float)>, str_uid("SetOrder")> SetOrder
设置order
Function< std::function< dl::Coor *()>, str_uid("GetCoor")> GetCoor
返回坐标系
Function< std::function< void()>, str_uid("Render")> Render
绘制
Function< std::function< void()>, str_uid("DeleteThis")> DeleteThis
删除自身
Function< std::function< void()>, str_uid("Update")> Update
逻辑
constexpr float OffsetOrder(float order, int u=1, int v=0, int w=0)
偏移order