From 2c22fe98ddae45d1553003a00a7ea0a301e9aa99 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 13 Nov 2012 21:47:07 +0000 Subject: (svn r24734) -Codechange: Move QueryStringBaseWindow::OnOSKInput to Window::OnEditboxChanged. --- src/ai/ai_gui.cpp | 2 +- src/genworld_gui.cpp | 2 +- src/misc_gui.cpp | 2 +- src/network/network_chat_gui.cpp | 2 +- src/network/network_content_gui.cpp | 2 +- src/network/network_gui.cpp | 4 ++-- src/newgrf_gui.cpp | 2 +- src/osk_gui.cpp | 3 +-- src/querystring_gui.h | 6 ------ src/settings_gui.cpp | 2 +- src/signs_gui.cpp | 2 +- src/window_gui.h | 6 ++++++ 12 files changed, 17 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 060f6b946..8a8db5b5c 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1354,7 +1354,7 @@ struct AIDebugWindow : public QueryStringBaseWindow { return state; } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_AID_BREAK_STR_EDIT_BOX) { /* Save the current string to static member so it can be restored next time the window is opened. */ diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 452223062..81ffd6a86 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -694,7 +694,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { } } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_GL_RANDOM_EDITBOX) { /* the seed is unsigned, therefore atoi cannot be used. diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 4d43db770..fbd3345e2 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -816,7 +816,7 @@ EventState QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 k EventState state = ES_NOT_HANDLED; switch (this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state)) { case HEBR_EDITING: - this->OnOSKInput(wid); + this->OnEditboxChanged(wid); break; case HEBR_CONFIRM: diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index af2357dc1..2e0be50ba 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -514,7 +514,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow { return state; } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { _chat_tab_completion_active = false; } diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 2262a09fb..069648001 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -779,7 +779,7 @@ public: return ES_HANDLED; } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_NCL_FILTER) { this->string_filter.SetFilterTerm(this->edit_str_buf); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index a3b5726d8..f1df26d6f 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -847,7 +847,7 @@ public: return state; } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_NG_CLIENT) { /* The name is only allowed when it starts with a letter! */ @@ -1170,7 +1170,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { this->SetDirty(); } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_NSS_GAMENAME) { strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 4cd60a7c4..827e694ff 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1276,7 +1276,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback { return ES_HANDLED; } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (!this->editable) return; diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 2dadb88cd..800b5ef54 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -203,8 +203,7 @@ struct OskWindow : public Window { void InvalidateParent() { - QueryStringBaseWindow *w = dynamic_cast(this->parent); - if (w != NULL) w->OnOSKInput(this->text_btn); + this->parent->OnEditboxChanged(this->text_btn); this->SetWidgetDirty(WID_OSK_TEXT); if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn); diff --git a/src/querystring_gui.h b/src/querystring_gui.h index 08f99f29d..9e9c23681 100644 --- a/src/querystring_gui.h +++ b/src/querystring_gui.h @@ -79,12 +79,6 @@ struct QueryStringBaseWindow : public Window, public QueryString { } EventState HandleEditBoxKey(int wid, uint16 key, uint16 keycode); - - /** - * Callback for when on input has been entered with the OSK. - * @param wid The widget the OSK was attached to. - */ - virtual void OnOSKInput(int wid) {} }; void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 839134030..720bdac1a 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2406,7 +2406,7 @@ struct GameSettingsWindow : QueryStringBaseWindow { this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded); } - virtual void OnOSKInput(int wid) + virtual void OnEditboxChanged(int wid) { if (wid == WID_GS_FILTER) { string_filter.SetFilterTerm(this->edit_str_buf); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 73d8af2b8..a7af05dbf 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -315,7 +315,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList { return state; } - virtual void OnOSKInput(int widget) + virtual void OnEditboxChanged(int widget) { if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->text.buf); } diff --git a/src/window_gui.h b/src/window_gui.h index 268f39132..da8836993 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -666,6 +666,12 @@ public: virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close); + /** + * The text in an editbox has been edited. + * @param widget The widget of the editbox. + */ + virtual void OnEditboxChanged(int widget) {} + /** * The query window opened from this window has closed. * @param str the new value of the string, NULL if the window -- cgit v1.2.3-70-g09d2