19#ifndef DL_DISABLE_RENDER
63 return _bg->IsPickup();
90 _cptElemData.
_hv = hv;
91 _cptElemData.
_pos = pos;
101 _progress =
dl::clamp(progress, 0.0f, 1.0f);
109 _progressK = progress_k;
155 _progressK{ 100.0f },
187 void _delete_this() {
delete this; }
198 void _refresh_text();
199 void _refresh_text_pos();
203 _cptDeleteThis = std::bind(&ProgressBar::_delete_this,
this);
208 _cptClone = std::bind(&ProgressBar::_clone,
this);
void PushBack(AnyType any)
添加一个任意对象
Position GetSize()
返回设置的大小(不包含额外大小)
void OnChangeElementData(Components *cpt)
void SetStringFormat(std::string_view fmt)
设置进度文本格式({} 表示百分比整数),传空串则不自动更新文本
UI::Text * GetText()
返回进度文本(可为空)
static ProgressBar * Create(UI::Background *bg, UI::Background *mid, UI::Text *txt=nullptr)
创建一个进度条
void SetProgressK(float progress_k)
设置显示倍数
void SetSize(const Position &size)
设置背景大小
void SetProgress(float progress)
设置进度 [0, 1]
void SetElementData(const Align::Direction2 &hv, const Position &pos={})
Align::Dir4 GetDir() const
返回显示方向
void SetMidRect(RectF mid_rect)
设置进度绘制范围
UI::Background * GetMid()
返回进度填充图(可为空)
ProgressBar * Clone()
复制一个,注意有些组件属性需要复制
float GetProgress() const
返回当前进度 [0, 1]
RectF GetMidRect() const
返回进度绘制范围
Panel * GetPanel()
返回自身panel,可继续挂载其它ui
void SetDir(Align::Dir4 dir)
设置显示方向(进度从哪个方向开始填充)
UI::Background * GetBackground()
返回背景(可为空)
void SetOrder(float order)
设置绘制顺序
Array< Direction, 2 > Direction2
Function< std::function< void(float)>, str_uid("SetOrder")> SetOrder
设置order
Function< std::function< dl::Coor *()>, str_uid("GetCoor")> GetCoor
返回坐标系
Function< std::function< bool()>, str_uid("IsPickup")> IsPickup
---------------------------—具体组件----------------------------------—
Function< std::function< void()>, str_uid("Render")> Render
绘制
Function< std::function< void()>, str_uid("DeleteThis")> DeleteThis
删除自身
Function< std::function< Components *()>, str_uid("Clone")> Clone
克隆
constexpr float OffsetOrder(float order, int u=1, int v=0, int w=0)
偏移order
constexpr float Z_DEFAULT_UI
constexpr T clamp(const T &x, const T &a, const T &b)
限制数值到 [a, b]