MCPcopy Create free account
hub / github.com/axmolengine/axmol / setString

Method setString

core/ui/UITextField.cpp:363–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363void TextField::setString(std::string_view text)
364{
365 std::string strText(text);
366
367 if (isMaxLengthEnabled())
368 {
369 int max = _textFieldRenderer->getMaxLength();
370 int32_t text_count = StringUtils::countUTF8Chars(text);
371 if (text_count > max)
372 {
373 strText = Helper::getSubStringOfUTF8String(strText, 0, max);
374 }
375 }
376
377 if (isPasswordEnabled())
378 {
379 _textFieldRenderer->setPasswordText(strText);
380 _textFieldRenderer->setString("");
381 _textFieldRenderer->insertText(strText.c_str(), strText.size());
382 }
383 else
384 {
385 _textFieldRenderer->setString(strText);
386 }
387 _textFieldRendererAdaptDirty = true;
388 updateContentSizeWithTextureSize(_textFieldRenderer->getContentSize());
389}
390
391void TextField::setPlaceHolder(std::string_view value)
392{

Callers

nothing calls this directly

Calls 8

countUTF8CharsFunction · 0.85
getSubStringOfUTF8StringFunction · 0.85
setPasswordTextMethod · 0.80
getMaxLengthMethod · 0.45
insertTextMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected