| 163 | } |
| 164 | |
| 165 | bool CEntryText::Insert(char16_t ch, CGump *gump) |
| 166 | { |
| 167 | if (m_Position < 0) |
| 168 | { |
| 169 | m_Position = 0; |
| 170 | } |
| 171 | |
| 172 | if (m_Position > (int)WText.length()) |
| 173 | { |
| 174 | m_Position = (int)WText.length(); |
| 175 | } |
| 176 | |
| 177 | if (MaxLength > 0) |
| 178 | { |
| 179 | if (NumberOnly) |
| 180 | { |
| 181 | auto str = WText; |
| 182 | str.insert(str.begin() + m_Position, ch); |
| 183 | if (str_to_int(str) >= MaxLength) |
| 184 | { |
| 185 | return false; |
| 186 | } |
| 187 | } |
| 188 | else if ((int)WText.length() >= MaxLength) |
| 189 | { |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | WText.insert(WText.begin() + m_Position, ch); |
| 195 | m_Position++; |
| 196 | Changed = true; |
| 197 | if (gump != nullptr) |
| 198 | { |
| 199 | gump->FrameCreated = false; |
| 200 | } |
| 201 | |
| 202 | return true; |
| 203 | } |
| 204 | |
| 205 | void CEntryText::Remove(bool left, CGump *gump) |
| 206 | { |
no test coverage detected