MCPcopy Create free account
hub / github.com/crossuo/crossuo / SetTextW

Method SetTextW

src/TextEngine/EntryText.cpp:304–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void CEntryText::SetTextW(const wstr_t &text)
305{
306 Clear();
307
308 WText = text;
309 m_Position = (int)WText.length();
310 if (m_Position < 0)
311 {
312 m_Position = 0;
313 }
314
315 if (MaxLength > 0)
316 {
317 if (NumberOnly)
318 {
319 auto str = str_from(WText);
320 while (true)
321 {
322 size_t len = str.length();
323
324 if (str_to_int(str) >= MaxLength && len > 0)
325 {
326 str.resize(len - 1);
327 }
328 else
329 {
330 break;
331 }
332 }
333 }
334 else if ((int)WText.length() >= MaxLength)
335 {
336 WText.resize(MaxLength);
337 }
338 }
339
340 CGump *gump = g_GumpManager.GetTextEntryOwner();
341 if (gump != nullptr)
342 {
343 gump->FrameCreated = false;
344 }
345}
346
347astr_t CEntryText::CheckMaxWidthA(uint8_t font, astr_t str)
348{

Callers 7

LoadMethod · 0.45
PasteMethod · 0.45
SetConsoleTypePrefixMethod · 0.45
ProcessMethod · 0.45
SetItemPropertiesModeMethod · 0.45
DisplayMethod · 0.45

Calls 6

ClearFunction · 0.85
str_fromFunction · 0.85
str_to_intFunction · 0.85
lengthMethod · 0.80
resizeMethod · 0.80
GetTextEntryOwnerMethod · 0.80

Tested by

no test coverage detected