14#ifndef DL_DISABLE_RENDER
47 EditBox* ret =
new EditBox;
108 && _timerCursor.Run(
g_time->GetDelta()))
109 _sprCursor->Render();
124 Position p = _txt->GetCoor()->ParentToThis(pos);
125 return _txt->Pos2CursorIndex(p);
134 return _txt->GetCoor()->ThisToParent(p);
141 return _panel->IsPickup();
197 _bSingleLine{ true },
204 _bChangeSelect{ false }
215 bool _bClickLoseFocus;
217 InputMode _inputMode;
219 std::size_t _maxSize;
220 std::size_t _iCursor;
231 std::vector<gcSprite> _vecSprSelect;
242 void _delete_this() {
delete this; }
251 _cptDeleteThis = std::bind(&EditBox::_delete_this,
this);
256 _cptClone = std::bind(&EditBox::_clone,
this);
258 _cpt.PushBack(&_cptDeleteThis);
259 _cpt.PushBack(&_cptSetOrder);
260 _cpt.PushBack(&_cptUpdate);
261 _cpt.PushBack(&_cptRender);
262 _cpt.PushBack(&_cptGetCoor);
263 _cpt.PushBack(&_cptClone);
265 _cpt.PushBack(&_cptElemData);
272 void _refresh_txt(
bool* focus =
nullptr);
273 void _refresh_cursor();
274 void _refresh_select();
278 void _delete_select();
280 bool _check_size(std::size_t add)
284 if (_str.size() + add <= _maxSize)
void SetInputMode(InputMode mode)
void _on_string(std::string_view str)
static EditBox * Create(Panel *panel, gcText txt)
创建输入框
void _on_focus(bool focus)
void SetSingleLine(bool single_line)
void SetColor(const std::vector< Color > &mul_col)
Position Cursor2Pos(size_t i)
下标 -> 本地坐标
void SetFocus(bool focus)
void SetString(std::string_view str)
void _on_char(char32_t ch)
size_t Pos2Cursor(const Position &pos)
本地坐标 -> 选中下标
std::string GetStringSelect()
void SetOrder(float order)
设置绘制顺序
Cpt::ElementData & GetElementData()
void SetStringTip(std::string_view str)
void SetOrderMode(OrderMode mode)
设置order模式
std::string Utf32ToUtf8(std::u32string_view str)
字符串转换:utf32 -> utf8
std::u32string Utf8ToUtf32(std::string_view str)
字符串转换:utf8 -> utf32
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
逻辑
Function< std::function< Components *()>, str_uid("Clone")> Clone
克隆
size_t FirstIndex(const T &container, const V &v)
find,返回下标
constexpr float OffsetOrder(float order, int u=1, int v=0, int w=0)
偏移order
constexpr float Z_DEFAULT_UI