1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsPrerequisites.h"
6#include "Input/BsInputFwd.h"
7
8namespace bs
9{
10 /** @addtogroup GUI-Internal
11 * @{
12 */
13
14 /** A key combination that is used for triggering keyboard shortcuts. Contains a button code and an optional modifier. */
15 struct BS_EXPORT ShortcutKey
16 {
17 struct BS_EXPORT Hash
18 {
19 size_t operator()(const ShortcutKey& x) const;
20 };
21
22 struct BS_EXPORT Equals
23 {
24 bool operator()(const ShortcutKey& a, const ShortcutKey& b) const;
25 };
26
27 ShortcutKey() = default;
28 ShortcutKey(ButtonModifier modifier, ButtonCode code);
29
30 /** Checks is the shortcut button and modifier combination valid. */
31 bool isValid() const { return button != BC_UNASSIGNED; }
32
33 /** Returns a readable name of the shortcut key (for example "Shift + F"). */
34 String getName() const;
35
36 ButtonModifier modifier = ButtonModifier::None;
37 ButtonCode button = BC_UNASSIGNED;
38
39 static const ShortcutKey NONE;
40 };
41
42 /** @} */
43}