(svn r25412) -Codechange: Make use of Window::OnHotkey

This commit is contained in:
frosch
2013-06-15 15:30:44 +00:00
parent 611c5aabe0
commit 303aa2f473
10 changed files with 77 additions and 114 deletions

View File

@@ -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. */