summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-11-13 21:46:58 +0000
committerfrosch <frosch@openttd.org>2012-11-13 21:46:58 +0000
commit7699a7dc06049956b90d3f41a14109ee05b97514 (patch)
treea27f6da660a39ae2345755a1a1c57fbeb2c025b8 /src/network
parentfd55399167115dbb06e77bb03f85681ba318f5f2 (diff)
downloadopenttd-7699a7dc06049956b90d3f41a14109ee05b97514.tar.xz
(svn r24732) -Codechange: Unify handling of OK and CANCEL actions for editboxes.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_chat_gui.cpp8
-rw-r--r--src/network/network_gui.cpp33
2 files changed, 10 insertions, 31 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 4c1551347..0cd9c0558 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -512,13 +512,7 @@ struct NetworkChatWindow : public QueryStringBaseWindow {
state = ES_HANDLED;
} else {
_chat_tab_completion_active = false;
- switch (this->HandleEditBoxKey(WID_NC_TEXTBOX, key, keycode, state)) {
- default: break;
- case HEBR_CONFIRM:
- SendChat(this->text.buf, this->dtype, this->dest);
- /* FALL THROUGH */
- case HEBR_CANCEL: delete this; break;
- }
+ this->HandleEditBoxKey(WID_NC_TEXTBOX, key, keycode, state);
}
return state;
}
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 94c2e3805..7b4735629 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -835,20 +835,15 @@ public:
return ES_HANDLED;
}
- switch (this->HandleEditBoxKey(WID_NG_CLIENT, key, keycode, state)) {
- case HEBR_NOT_FOCUSED:
- if (this->server != NULL) {
- if (keycode == WKC_DELETE) { // Press 'delete' to remove servers
- NetworkGameListRemoveItem(this->server);
- if (this->server == this->last_joined) this->last_joined = NULL;
- this->server = NULL;
- this->list_pos = SLP_INVALID;
- }
+ if (this->HandleEditBoxKey(WID_NG_CLIENT, key, keycode, state) == HEBR_NOT_FOCUSED) {
+ if (this->server != NULL) {
+ if (keycode == WKC_DELETE) { // Press 'delete' to remove servers
+ NetworkGameListRemoveItem(this->server);
+ if (this->server == this->last_joined) this->last_joined = NULL;
+ this->server = NULL;
+ this->list_pos = SLP_INVALID;
}
- break;
-
- default:
- break;
+ }
}
return state;
@@ -2160,17 +2155,7 @@ struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
- switch (this->HandleEditBoxKey(WID_NCP_PASSWORD, key, keycode, state)) {
- default: break;
-
- case HEBR_CONFIRM:
- this->OnOk();
- /* FALL THROUGH */
-
- case HEBR_CANCEL:
- delete this;
- break;
- }
+ this->HandleEditBoxKey(WID_NCP_PASSWORD, key, keycode, state);
return state;
}
};