| 302 | } |
| 303 | |
| 304 | void 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 | |
| 347 | astr_t CEntryText::CheckMaxWidthA(uint8_t font, astr_t str) |
| 348 | { |
no test coverage detected