MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetTextCharacterAtPosition

Method GetTextCharacterAtPosition

src/window.cpp:410–417  ·  view source on GitHub ↗

* Get the character that is rendered at a position by the focused edit box. * @param pt The position to test. * @return Index of the character position or -1 if no character is at the position. */ virtual */

Source from the content-addressed store, hash-verified

408 * @return Index of the character position or -1 if no character is at the position.
409 */
410/* virtual */ ptrdiff_t Window::GetTextCharacterAtPosition(const Point &pt) const
411{
412 if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
413 return this->GetQueryString(this->nested_focus->GetIndex())->GetCharAtPosition(this, this->nested_focus->GetIndex(), pt);
414 }
415
416 return -1;
417}
418
419/**
420 * Set the window that has the focus

Callers

nothing calls this directly

Calls 3

GetQueryStringMethod · 0.95
GetCharAtPositionMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected