summaryrefslogtreecommitdiff
path: root/src/signs_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-15 15:30:44 +0000
committerfrosch <frosch@openttd.org>2013-06-15 15:30:44 +0000
commit5cb174c6b86c58b2ff6ec0d245e546328fae6480 (patch)
tree3daf547fa10b3e701086c7e0546cded7e6261bbb /src/signs_gui.cpp
parent62913838237c474419c68124ea7aebd74e72c628 (diff)
downloadopenttd-5cb174c6b86c58b2ff6ec0d245e546328fae6480.tar.xz
(svn r25412) -Codechange: Make use of Window::OnHotkey
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r--src/signs_gui.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 7e4cdfba4..3966742f0 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -281,16 +281,19 @@ struct SignListWindow : Window, SignList {
}
}
- virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+ virtual EventState OnHotkey(int hotkey)
{
- EventState state = ES_NOT_HANDLED;
- if (this->hotkeys.CheckMatch(keycode) == SLHK_FOCUS_FILTER_BOX) {
- this->SetFocusedWidget(WID_SIL_FILTER_TEXT);
- SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused.
- state = ES_HANDLED;
+ switch (hotkey) {
+ case SLHK_FOCUS_FILTER_BOX:
+ this->SetFocusedWidget(WID_SIL_FILTER_TEXT);
+ SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused.
+ break;
+
+ default:
+ return ES_NOT_HANDLED;
}
- return state;
+ return ES_HANDLED;
}
virtual void OnEditboxChanged(int widget)
@@ -374,7 +377,8 @@ static WindowDesc _sign_list_desc(
WDP_AUTO, "list_signs", 358, 138,
WC_SIGN_LIST, WC_NONE,
0,
- _nested_sign_list_widgets, lengthof(_nested_sign_list_widgets)
+ _nested_sign_list_widgets, lengthof(_nested_sign_list_widgets),
+ &SignListWindow::hotkeys
);
/**
@@ -393,7 +397,7 @@ EventState SignListGlobalHotkeys(uint16 key, uint16 keycode)
if (num == -1) return ES_NOT_HANDLED;
Window *w = ShowSignList();
if (w == NULL) return ES_NOT_HANDLED;
- return w->OnKeyPress(key, keycode);
+ return w->OnHotkey(num);
}
/**