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

Method InsertTextString

src/window.cpp:2722–2731  ·  view source on GitHub ↗

* Insert a text string at the cursor position into the edit box widget. * @param wid Edit box widget. * @param str Text string to insert. */ virtual */

Source from the content-addressed store, hash-verified

2720 * @param str Text string to insert.
2721 */
2722/* virtual */ void Window::InsertTextString(WidgetID wid, std::string_view str, bool marked, std::optional<size_t> caret, std::optional<size_t> insert_location, std::optional<size_t> replacement_end)
2723{
2724 QueryString *query = this->GetQueryString(wid);
2725 if (query == nullptr) return;
2726
2727 if (query->text.InsertString(str, marked, caret, insert_location, replacement_end) || marked) {
2728 this->SetWidgetDirty(wid);
2729 this->OnEditboxChanged(wid);
2730 }
2731}
2732
2733/**
2734 * Handle text input.

Callers 1

HandleTextInputFunction · 0.45

Calls 4

GetQueryStringMethod · 0.95
SetWidgetDirtyMethod · 0.95
OnEditboxChangedMethod · 0.95
InsertStringMethod · 0.80

Tested by

no test coverage detected