| 1 |
/* |
| 2 |
* Copyright (C) 2016-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 "input/mouse/MouseTypes.h" |
| 12 |
|
| 13 |
#include <string> |
| 14 |
|
| 15 |
namespace KODI |
| 16 |
{ |
| 17 |
namespace MOUSE |
| 18 |
{ |
| 19 |
/*! |
| 20 |
* \ingroup mouse |
| 21 |
* |
| 22 |
* \brief Interface for handling mouse events |
| 23 |
*/ |
| 24 |
class IMouseInputHandler |
| 25 |
{ |
| 26 |
public: |
| 27 |
virtual ~IMouseInputHandler(void) = default; |
| 28 |
|
| 29 |
/*! |
| 30 |
* \brief The controller profile for this mouse input handler |
| 31 |
* |
| 32 |
* \return The ID of the add-on extending kodi.game.controller |
| 33 |
*/ |
| 34 |
virtual std::string ControllerID(void) const = 0; |
| 35 |
|
| 36 |
/*! |
| 37 |
* \brief A relative pointer has moved |
| 38 |
* |
| 39 |
* \param relpointer The name of the relative pointer being moved |
| 40 |
* \param dx The relative x coordinate of motion |
| 41 |
* \param dy The relative y coordinate of motion |
| 42 |
* |
| 43 |
* The mouse uses a left-handed (graphics) cartesian coordinate system. |
| 44 |
* Positive X is right, positive Y is down. |
| 45 |
* |
| 46 |
* \return True if the event was handled, otherwise false |
| 47 |
*/ |
| 48 |
virtual bool OnMotion(const PointerName& relpointer, int dx, int dy) = 0; |
| 49 |
|
| 50 |
/*! |
| 51 |
* \brief A mouse button has been pressed |
| 52 |
* |
| 53 |
* \param button The name of the feature being pressed |
| 54 |
* |
| 55 |
* \return True if the event was handled, otherwise false |
| 56 |
*/ |
| 57 |
virtual bool OnButtonPress(const ButtonName& button) = 0; |
| 58 |
|
| 59 |
/*! |
| 60 |
* \brief A mouse button has been released |
| 61 |
* |
| 62 |
* \param button The name of the feature being released |
| 63 |
*/ |
| 64 |
virtual void OnButtonRelease(const ButtonName& button) = 0; |
| 65 |
|
| 66 |
/*! |
| 67 |
* \brief Called at the end of the frame that provided input |
| 68 |
* |
| 69 |
* This can be as a result of a pointer update, a button press, or a button |
| 70 |
* release. All three events will result in a call to OnInputFrame(). |
| 71 |
*/ |
| 72 |
virtual void OnInputFrame() = 0; |
| 73 |
}; |
| 74 |
} // namespace MOUSE |
| 75 |
} // namespace KODI |