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

Method GetTextBoundingRect

src/window.cpp:395–403  ·  view source on GitHub ↗

* Get the bounding rectangle for a text range if an edit box has the focus. * @param from Start of the string range. * @param to End of the string range. * @return Rectangle encompassing the string range, relative to the window. */ virtual */

Source from the content-addressed store, hash-verified

393 * @return Rectangle encompassing the string range, relative to the window.
394 */
395/* virtual */ Rect Window::GetTextBoundingRect(size_t from, size_t to) const
396{
397 if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
398 return this->GetQueryString(this->nested_focus->GetIndex())->GetBoundingRect(this, this->nested_focus->GetIndex(), from, to);
399 }
400
401 Rect r = {0, 0, 0, 0};
402 return r;
403}
404
405/**
406 * Get the character that is rendered at a position by the focused edit box.

Callers

nothing calls this directly

Calls 3

GetQueryStringMethod · 0.95
GetBoundingRectMethod · 0.80
GetIndexMethod · 0.45

Tested by

no test coverage detected