| 1 |
/* |
| 2 |
* Copyright (C) 2017-2024 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <set> |
| 12 |
#include <string> |
| 13 |
|
| 14 |
namespace KODI |
| 15 |
{ |
| 16 |
namespace KEYMAP |
| 17 |
{ |
| 18 |
/*! |
| 19 |
* \ingroup keymap |
| 20 |
* |
| 21 |
* \brief Interface for a class working with a keymap |
| 22 |
*/ |
| 23 |
class IKeymapHandler |
| 24 |
{ |
| 25 |
public: |
| 26 |
virtual ~IKeymapHandler() = default; |
| 27 |
|
| 28 |
/*! |
| 29 |
* \brief Get the pressed state of the given keys |
| 30 |
* |
| 31 |
* \param keyNames The key names |
| 32 |
* |
| 33 |
* \return True if all keys are pressed or no keys are given, false otherwise |
| 34 |
*/ |
| 35 |
virtual bool HotkeysPressed(const std::set<std::string>& keyNames) const = 0; |
| 36 |
|
| 37 |
/*! |
| 38 |
* \brief Get the key name of the last button pressed |
| 39 |
* |
| 40 |
* \return The key name of the last-pressed button, or empty if no button |
| 41 |
* is pressed |
| 42 |
*/ |
| 43 |
virtual std::string GetLastPressed() const = 0; |
| 44 |
|
| 45 |
/*! |
| 46 |
* \brief Called when a key has emitted an action after bring pressed |
| 47 |
* |
| 48 |
* \param keyName the key name that emitted the action |
| 49 |
*/ |
| 50 |
virtual void OnPress(const std::string& keyName) = 0; |
| 51 |
}; |
| 52 |
} // namespace KEYMAP |
| 53 |
} // namespace KODI |