1
0
Fork 0

(svn r24734) -Codechange: Move QueryStringBaseWindow::OnOSKInput to Window::OnEditboxChanged.

release/1.3
frosch 2012-11-13 21:47:07 +00:00
parent c4d7c8dd42
commit 2c22fe98dd
12 changed files with 17 additions and 18 deletions

View File

@ -1354,7 +1354,7 @@ struct AIDebugWindow : public QueryStringBaseWindow {
return state; return state;
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_AID_BREAK_STR_EDIT_BOX) { 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. */ /* Save the current string to static member so it can be restored next time the window is opened. */

View File

@ -694,7 +694,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
} }
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_GL_RANDOM_EDITBOX) { if (wid == WID_GL_RANDOM_EDITBOX) {
/* the seed is unsigned, therefore atoi cannot be used. /* the seed is unsigned, therefore atoi cannot be used.

View File

@ -816,7 +816,7 @@ EventState QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 k
EventState state = ES_NOT_HANDLED; EventState state = ES_NOT_HANDLED;
switch (this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state)) { switch (this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state)) {
case HEBR_EDITING: case HEBR_EDITING:
this->OnOSKInput(wid); this->OnEditboxChanged(wid);
break; break;
case HEBR_CONFIRM: case HEBR_CONFIRM:

View File

@ -514,7 +514,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
return state; return state;
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
_chat_tab_completion_active = false; _chat_tab_completion_active = false;
} }

View File

@ -779,7 +779,7 @@ public:
return ES_HANDLED; return ES_HANDLED;
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_NCL_FILTER) { if (wid == WID_NCL_FILTER) {
this->string_filter.SetFilterTerm(this->edit_str_buf); this->string_filter.SetFilterTerm(this->edit_str_buf);

View File

@ -847,7 +847,7 @@ public:
return state; return state;
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_NG_CLIENT) { if (wid == WID_NG_CLIENT) {
/* The name is only allowed when it starts with a letter! */ /* The name is only allowed when it starts with a letter! */
@ -1170,7 +1170,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
this->SetDirty(); this->SetDirty();
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_NSS_GAMENAME) { if (wid == WID_NSS_GAMENAME) {
strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));

View File

@ -1276,7 +1276,7 @@ struct NewGRFWindow : public QueryStringBaseWindow, NewGRFScanCallback {
return ES_HANDLED; return ES_HANDLED;
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (!this->editable) return; if (!this->editable) return;

View File

@ -203,8 +203,7 @@ struct OskWindow : public Window {
void InvalidateParent() void InvalidateParent()
{ {
QueryStringBaseWindow *w = dynamic_cast<QueryStringBaseWindow*>(this->parent); this->parent->OnEditboxChanged(this->text_btn);
if (w != NULL) w->OnOSKInput(this->text_btn);
this->SetWidgetDirty(WID_OSK_TEXT); this->SetWidgetDirty(WID_OSK_TEXT);
if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn); if (this->parent != NULL) this->parent->SetWidgetDirty(this->text_btn);

View File

@ -79,12 +79,6 @@ struct QueryStringBaseWindow : public Window, public QueryString {
} }
EventState HandleEditBoxKey(int wid, uint16 key, uint16 keycode); 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); void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button);

View File

@ -2406,7 +2406,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded); this->SetWidgetDisabledState(WID_GS_COLLAPSE_ALL, all_folded);
} }
virtual void OnOSKInput(int wid) virtual void OnEditboxChanged(int wid)
{ {
if (wid == WID_GS_FILTER) { if (wid == WID_GS_FILTER) {
string_filter.SetFilterTerm(this->edit_str_buf); string_filter.SetFilterTerm(this->edit_str_buf);

View File

@ -315,7 +315,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
return state; return state;
} }
virtual void OnOSKInput(int widget) virtual void OnEditboxChanged(int widget)
{ {
if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->text.buf); if (widget == WID_SIL_FILTER_TEXT) this->SetFilterString(this->text.buf);
} }

View File

@ -666,6 +666,12 @@ public:
virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close); 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. * The query window opened from this window has closed.
* @param str the new value of the string, NULL if the window * @param str the new value of the string, NULL if the window