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

Method GetCaretPosition

src/window.cpp:379–387  ·  view source on GitHub ↗

* Get the current caret position if an edit box has the focus. * @return Top-left location of the caret, relative to the window. */ virtual */

Source from the content-addressed store, hash-verified

377 * @return Top-left location of the caret, relative to the window.
378 */
379/* virtual */ Point Window::GetCaretPosition() const
380{
381 if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX && !this->querystrings.empty()) {
382 return this->GetQueryString(this->nested_focus->GetIndex())->GetCaretPosition(this, this->nested_focus->GetIndex());
383 }
384
385 Point pt = {0, 0};
386 return pt;
387}
388
389/**
390 * Get the bounding rectangle for a text range if an edit box has the focus.

Callers 2

SetCompositionPosFunction · 0.45
SetCandidatePosFunction · 0.45

Calls 3

GetQueryStringMethod · 0.95
emptyMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected