| 1 |
/* |
| 2 |
* Copyright (C) 2015-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 |
namespace KODI |
| 12 |
{ |
| 13 |
namespace KEYMAP |
| 14 |
{ |
| 15 |
/*! |
| 16 |
* \ingroup keymap |
| 17 |
* |
| 18 |
* \brief Interface for handling keymap keys |
| 19 |
* |
| 20 |
* Keys can be mapped to analog actions (e.g. "AnalogSeekForward") or digital |
| 21 |
* actions (e.g. "Up"). |
| 22 |
*/ |
| 23 |
class IKeyHandler |
| 24 |
{ |
| 25 |
public: |
| 26 |
virtual ~IKeyHandler() = default; |
| 27 |
|
| 28 |
/*! |
| 29 |
* \brief Return true if the key is "pressed" (has a magnitude greater |
| 30 |
* than 0.5) |
| 31 |
* |
| 32 |
* \return True if the key is "pressed", false otherwise |
| 33 |
*/ |
| 34 |
virtual bool IsPressed() const = 0; |
| 35 |
|
| 36 |
/*! |
| 37 |
* \brief A key mapped to a digital feature has been pressed or released |
| 38 |
* |
| 39 |
* \param bPressed true if the key's button/axis is activated, false if deactivated |
| 40 |
* \param holdTimeMs The held time in ms for pressed buttons, or 0 for released |
| 41 |
* |
| 42 |
* \return True if the key is mapped to an action, false otherwise |
| 43 |
*/ |
| 44 |
virtual bool OnDigitalMotion(bool bPressed, unsigned int holdTimeMs) = 0; |
| 45 |
|
| 46 |
/*! |
| 47 |
* \brief Callback for keys mapped to analog features |
| 48 |
* |
| 49 |
* \param magnitude The amount of the analog action |
| 50 |
* \param motionTimeMs The time since the magnitude was 0 |
| 51 |
* |
| 52 |
* \return True if the key is mapped to an action, false otherwise |
| 53 |
*/ |
| 54 |
virtual bool OnAnalogMotion(float magnitude, unsigned int motionTimeMs) = 0; |
| 55 |
}; |
| 56 |
} // namespace KEYMAP |
| 57 |
} // namespace KODI |