diff options
author | frosch <frosch@openttd.org> | 2012-11-13 21:46:46 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-11-13 21:46:46 +0000 |
commit | 6d1fe626f5524dc05febe0a715fd9ba80108befd (patch) | |
tree | b85ef2897db71dc2ab9fbce7a5db441dffce755a /src/misc_gui.cpp | |
parent | 336fcbc50e89b357fa5b9e059961b4a0c00de59e (diff) | |
download | openttd-6d1fe626f5524dc05febe0a715fd9ba80108befd.tar.xz |
(svn r24729) -Codechange: Unify the handling of HEBR_EDITING.
Diffstat (limited to 'src/misc_gui.cpp')
-rw-r--r-- | src/misc_gui.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index d941f0633..18ec4d8ee 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -757,6 +757,9 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key } } + Window *osk = FindWindowById(WC_OSK, 0); + if (osk != NULL && osk->parent == w) osk->InvalidateData(); + return HEBR_EDITING; } @@ -810,7 +813,15 @@ void QueryString::DrawEditBox(const Window *w, int wid) const HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state) { - return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state); + HandleEditBoxResult result = this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state); + switch (result) { + case HEBR_EDITING: + this->OnOSKInput(wid); + break; + + default: break; + } + return result; } void QueryStringBaseWindow::OnOpenOSKWindow(int wid) @@ -898,16 +909,10 @@ struct QueryStringWindow : public QueryStringBaseWindow { EventState state = ES_NOT_HANDLED; switch (this->HandleEditBoxKey(WID_QS_TEXT, key, keycode, state)) { - default: NOT_REACHED(); - case HEBR_EDITING: { - Window *osk = FindWindowById(WC_OSK, 0); - if (osk != NULL && osk->parent == this) osk->InvalidateData(); - break; - } + default: break; case HEBR_CONFIRM: this->OnOk(); /* FALL THROUGH */ case HEBR_CANCEL: delete this; break; // close window, abandon changes - case HEBR_NOT_FOCUSED: break; } return state; } |