* Checks if adding a certain character to * the text edit will exceed the maximum width. * Used to make sure user input stays within bounds. * @param c Character to add. * @return True if it exceeds, False if it doesn't. */
| 346 | * @return True if it exceeds, False if it doesn't. |
| 347 | */ |
| 348 | bool TextEdit::exceedsMaxWidth(wchar_t c) |
| 349 | { |
| 350 | int w = 0; |
| 351 | std::wstring s = _value; |
| 352 | |
| 353 | s += c; |
| 354 | for (std::wstring::iterator i = s.begin(); i < s.end(); ++i) |
| 355 | { |
| 356 | w += _text->getFont()->getCharSize(*i).w; |
| 357 | } |
| 358 | |
| 359 | return (w > getWidth()); |
| 360 | } |
| 361 | |
| 362 | /** |
| 363 | * Focuses the text edit when it's pressed on. |
nothing calls this directly
no test coverage detected