Data Structures | Defines | Functions

# hotkeys.h File Reference

Hotkey related functions. More...

`#include "core/smallvec_type.hpp"`
`#include "gfx_type.h"`

Go to the source code of this file.

## Data Structures
struct | Hotkey< T >
| All data for a single hotkey. More...
struct | Hotkey< T >::CallbackWrapper
| A wrapper around the callback function. More...
## Defines
#define | HOTKEY_LIST_END(window_class) Hotkey<window_class>((uint16)0, NULL, -1)
## Functions
template<class T >
int | CheckHotkeyMatch (Hotkey< T > *list, uint16 keycode, T *w, bool global_only=false)
| Check if a keycode is bound to something.
bool | IsQuitKey (uint16 keycode)
| Does the given keycode match one of the keycodes bound to 'quit game'?
void | LoadHotkeysFromConfig ()
| Load the hotkeys from the config file.
void | SaveHotkeysToConfig ()
| Save the hotkeys to the config file.
void | HandleGlobalHotkeys (uint16 key, uint16 keycode)

## Detailed Description

Hotkey related functions.

Definition in file hotkeys.h.

## Function Documentation

template<class T >

int CheckHotkeyMatch | ( | Hotkey< T > * | list,
|  | uint16 | keycode,
|  | T * | w,
|  | bool | global_only = `false` |
| ) |  |  |

Check if a keycode is bound to something.

Parameters:

  | list | The list with hotkeys to check
  | keycode | The keycode that was pressed
  | w | The window-pointer to give to the callback function (if any).
  | global_only | Limit the search to hotkeys defined as 'global'.

Returns:
  The number of the matching hotkey or -1.

Definition at line 115 of file hotkeys.h.

References SmallVector< T, S >::Contains(), and WKC_GLOBAL_HOTKEY.

Referenced by ScenarioEditorToolbarWindow::OnKeyPress(), MainToolbarWindow::OnKeyPress(), ScenarioEditorLandscapeGenerationWindow::OnKeyPress(), TerraformToolbarWindow::OnKeyPress(), BuildRoadToolbarWindow::OnKeyPress(), BuildRailToolbarWindow::OnKeyPress(), MainWindow::OnKeyPress(), BuildDocksToolbarWindow::OnKeyPress(), and BuildAirToolbarWindow::OnKeyPress().

bool IsQuitKey | ( | uint16 | keycode | ) |

Does the given keycode match one of the keycodes bound to 'quit game'?

Parameters:

  | keycode | The keycode that was pressed by the user.

Returns:
  True iff the keycode matches one of the hotkeys for 'quit'.

Definition at line 529 of file main_gui.cpp.

Referenced by EndGameHighScoreBaseWindow::OnKeyPress().