38 lines
671 B
C++
38 lines
671 B
C++
#include "dl_ui_text.h"
|
|
|
|
#ifndef DL_DISABLE_RENDER
|
|
#include "dl_ui_panel.h"
|
|
|
|
namespace dl::UI
|
|
{
|
|
|
|
void Text::SetElementData(const Align::Direction2& hv, const Position& pos)
|
|
{
|
|
_cptElemData._size = toPosition(_txt->GetSize());
|
|
_cptElemData._anchor = {};
|
|
_cptElemData._hv = hv;
|
|
_cptElemData._pos = pos;
|
|
|
|
// 在组内则更新位置
|
|
if (_panel)
|
|
_panel->OnChangeElementData(&_cpt);
|
|
}
|
|
|
|
dl::UI::Text* Text::Clone()
|
|
{
|
|
Text* ret = new Text;
|
|
ret->_txt = g_factory->CloneText(_txt);
|
|
ret->_cptElemData = _cptElemData;
|
|
|
|
//存在则复制 语言属性
|
|
if (Cpt::Lang* cpt = _cpt.Get<Cpt::Lang>())
|
|
{
|
|
ret->SetLang(cpt->_str[0], cpt->_str[1]);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
}
|
|
|
|
#endif |