summaryrefslogtreecommitdiff
path: root/src/toolbar_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/toolbar_gui.cpp
parent62913838237c474419c68124ea7aebd74e72c628 (diff)
downloadopenttd-5cb174c6b86c58b2ff6ec0d245e546328fae6480.tar.xz
(svn r25412) -Codechange: Make use of Window::OnHotkey
Diffstat (limited to 'src/toolbar_gui.cpp')
-rw-r--r--src/toolbar_gui.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp
index 30287b76c..7a66deb61 100644
--- a/src/toolbar_gui.cpp
+++ b/src/toolbar_gui.cpp
@@ -1660,9 +1660,9 @@ struct MainToolbarWindow : Window {
if (cbf != CBF_NONE) this->last_started_action = cbf;
}
- virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+ virtual EventState OnHotkey(int hotkey)
{
- switch (this->hotkeys.CheckMatch(keycode)) {
+ switch (hotkey) {
case MTHK_PAUSE: ToolbarPauseClick(this); break;
case MTHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
case MTHK_SETTINGS: ShowGameOptions(); break;
@@ -1868,7 +1868,8 @@ static WindowDesc _toolb_normal_desc(
WDP_MANUAL, NULL, 640, 22,
WC_MAIN_TOOLBAR, WC_NONE,
WDF_NO_FOCUS,
- _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets)
+ _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets),
+ &MainToolbarWindow::hotkeys
);
@@ -2006,10 +2007,10 @@ struct ScenarioEditorToolbarWindow : Window {
if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
}
- virtual EventState OnKeyPress(uint16 key, uint16 keycode)
+ virtual EventState OnHotkey(int hotkey)
{
CallBackFunction cbf = CBF_NONE;
- switch (this->hotkeys.CheckMatch(keycode)) {
+ switch (hotkey) {
case MTEHK_PAUSE: ToolbarPauseClick(this); break;
case MTEHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
case MTEHK_SETTINGS: ShowGameOptions(); break;
@@ -2179,7 +2180,8 @@ static WindowDesc _toolb_scen_desc(
WDP_MANUAL, NULL, 640, 22,
WC_MAIN_TOOLBAR, WC_NONE,
WDF_NO_FOCUS,
- _nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets)
+ _nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets),
+ &ScenarioEditorToolbarWindow::hotkeys
);
/** Allocate the toolbar. */