Debian Codegraph @

xbmc/input/touch/generic/GenericTouchActionHandler.h

raw
1 /*
2 * Copyright (C) 2013-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/touch/ITouchActionHandler.h"
12
13 /*!
14 * \ingroup touch_generic
15 * \brief Generic implementation of ITouchActionHandler to translate
16 * touch actions into XBMC specific and mappable actions.
17 *
18 * \sa ITouchActionHandler
19 */
20 class CGenericTouchActionHandler : public ITouchActionHandler
21 {
22 public:
23 /*!
24 \brief Get an instance of the touch input manager
25 */
26 static CGenericTouchActionHandler& GetInstance();
27
28 // implementation of ITouchActionHandler
29 void OnTouchAbort() override;
30
31 bool OnSingleTouchStart(float x, float y) override;
32 bool OnSingleTouchHold(float x, float y) override;
33 bool OnSingleTouchMove(
34 float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override;
35 bool OnSingleTouchEnd(float x, float y) override;
36
37 bool OnMultiTouchDown(float x, float y, int32_t pointer) override;
38 bool OnMultiTouchHold(float x, float y, int32_t pointers = 2) override;
39 bool OnMultiTouchMove(float x,
40 float y,
41 float offsetX,
42 float offsetY,
43 float velocityX,
44 float velocityY,
45 int32_t pointer) override;
46 bool OnMultiTouchUp(float x, float y, int32_t pointer) override;
47
48 bool OnTouchGestureStart(float x, float y) override;
49 bool OnTouchGesturePan(
50 float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override;
51 bool OnTouchGestureEnd(
52 float x, float y, float offsetX, float offsetY, float velocityX, float velocityY) override;
53
54 // convenience events
55 void OnTap(float x, float y, int32_t pointers = 1) override;
56 void OnLongPress(float x, float y, int32_t pointers = 1) override;
57 void OnSwipe(TouchMoveDirection direction,
58 float xDown,
59 float yDown,
60 float xUp,
61 float yUp,
62 float velocityX,
63 float velocityY,
64 int32_t pointers = 1) override;
65 void OnZoomPinch(float centerX, float centerY, float zoomFactor) override;
66 void OnRotate(float centerX, float centerY, float angle) override;
67
68 /*!
69 \brief Asks the control at the given coordinates for a list of the supported gestures.
70
71 \param x The x coordinate (with sub-pixel) of the touch
72 \param y The y coordinate (with sub-pixel) of the touch
73
74 \return EVENT_RESULT value of bitwise ORed gestures.
75 */
76 int QuerySupportedGestures(float x, float y);
77
78 private:
79 // private construction, and no assignments; use the provided singleton methods
80 CGenericTouchActionHandler() = default;
81 CGenericTouchActionHandler(const CGenericTouchActionHandler&) = delete;
82 CGenericTouchActionHandler const& operator=(CGenericTouchActionHandler const&) = delete;
83 ~CGenericTouchActionHandler() override = default;
84
85 void sendEvent(int actionId,
86 float x,
87 float y,
88 float x2 = 0.0f,
89 float y2 = 0.0f,
90 float x3 = 0.0f,
91 float y3 = 0.0f,
92 int pointers = 1);
93 void focusControl(float x, float y);
94 };