diff options
author | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:37:06 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2013-08-05 20:37:06 +0000 |
commit | 7422120014b51f0057bb41b3e9b6405957a01b63 (patch) | |
tree | 2a56e09275b9e9e75f8be57f4ca1c0b7d39ee3c3 /src/window.cpp | |
parent | 13873d2534208ddc4596a9354d23d1e4940339ac (diff) | |
download | openttd-7422120014b51f0057bb41b3e9b6405957a01b63.tar.xz |
(svn r25679) -Codechange: [Win32] Get the result string of an IME input directly without a trip through the window messaging system.
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp index 1ef8afa44..522a10a6f 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2533,6 +2533,33 @@ void HandleCtrlChanged() } /** + * 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 */ void Window::InsertTextString(int wid, const char *str) +{ + QueryString *query = this->GetQueryString(wid); + if (query == NULL) return; + + if (query->text.InsertString(str)) { + this->SetWidgetDirty(wid); + this->OnEditboxChanged(wid); + } +} + +/** + * Handle text input. + * @param str Text string to input. + */ +void HandleTextInput(const char *str) +{ + if (!EditBoxInGlobalFocus()) return; + + _focused_window->InsertTextString(_focused_window->window_class == WC_CONSOLE ? 0 : _focused_window->nested_focus->index, str); +} + +/** * Local counter that is incremented each time an mouse input event is detected. * The counter is used to stop auto-scrolling. * @see HandleAutoscroll() |