diff options
author | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:37:44 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:37:44 +0000 |
commit | f5e41314922604c160efc4ac18c77056a1b66400 (patch) | |
tree | 38f170e1e3a23264104803d4b573ab43644e23a0 /src/window.cpp | |
parent | c64e297e0c3f5f1f59a21d1ad3e12e6834e155d7 (diff) | |
download | openttd-f5e41314922604c160efc4ac18c77056a1b66400.tar.xz |
(svn r25689) -Add: [OSX] Display the IME composition string ourself.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 1197b0c6e..907f575c6 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -324,6 +324,46 @@ QueryString *Window::GetQueryString(uint widnum) } /** + * Get the current input text if an edit box has the focus. + * @return The currently focused input text or NULL if no input focused. + */ +/* virtual */ const char *Window::GetFocusedText() const +{ + if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) { + return this->GetQueryString(this->nested_focus->index)->GetText(); + } + + return NULL; +} + +/** + * Get the string at the caret if an edit box has the focus. + * @return The text at the caret or NULL if no edit box is focused. + */ +/* virtual */ const char *Window::GetCaret() const +{ + if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) { + return this->GetQueryString(this->nested_focus->index)->GetCaret(); + } + + return NULL; +} + +/** + * 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 NULL if no text is marked. + */ +/* virtual */ const char *Window::GetMarkedText(size_t *length) const +{ + if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) { + return this->GetQueryString(this->nested_focus->index)->GetMarkedText(length); + } + + return NULL; +} + +/** * Get the current caret position if an edit box has the focus. * @return Top-left location of the caret, relative to the window. */ |