Codechange: use Textbuf directly, instead via several virtual functions in Window

This commit is contained in:
Rubidium
2023-07-01 22:05:07 +02:00
committed by rubidium42
parent 0316940fe8
commit 8c742b456f
7 changed files with 37 additions and 95 deletions

View File

@@ -365,40 +365,13 @@ void Window::UpdateQueryStringSize()
}
/**
* Get the current input text if an edit box has the focus.
* @return The currently focused input text or nullptr if no input focused.
* Get the current input text buffer.
* @return The currently focused input text buffer or nullptr if no input focused.
*/
/* virtual */ const char *Window::GetFocusedText() const
/* virtual */ const Textbuf *Window::GetFocusedTextbuf() const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetText();
}
return nullptr;
}
/**
* Get the string at the caret if an edit box has the focus.
* @return The text at the caret or nullptr if no edit box is focused.
*/
/* virtual */ const char *Window::GetCaret() const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetCaret();
}
return nullptr;
}
/**
* Get the range of the currently marked input text.
* @param[out] length Length of the marked text.
* @return Pointer to the start of the marked text or nullptr if no text is marked.
*/
/* virtual */ const char *Window::GetMarkedText(size_t *length) const
{
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) {
return this->GetQueryString(this->nested_focus->index)->GetMarkedText(length);
return &this->GetQueryString(this->nested_focus->index)->text;
}
return nullptr;