Debian Codegraph @

xbmc/input/touch/generic/GenericTouchSwipeDetector.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/generic/IGenericTouchGestureDetector.h"
12
13 /*!
14 * \ingroup touch_generic
15 * \brief Implementation of IGenericTouchGestureDetector to detect swipe
16 * gestures in any direction.
17 *
18 * \sa IGenericTouchGestureDetector
19 */
20 class CGenericTouchSwipeDetector : public IGenericTouchGestureDetector
21 {
22 public:
23 CGenericTouchSwipeDetector(ITouchActionHandler* handler, float dpi);
24 ~CGenericTouchSwipeDetector() override = default;
25
26 bool OnTouchDown(unsigned int index, const Pointer& pointer) override;
27 bool OnTouchUp(unsigned int index, const Pointer& pointer) override;
28 bool OnTouchMove(unsigned int index, const Pointer& pointer) override;
29 bool OnTouchUpdate(unsigned int index, const Pointer& pointer) override;
30
31 private:
32 /*!
33 * \brief Swipe directions that are still possible to detect
34 *
35 * The directions are stored as a combination (bitwise OR) of
36 * TouchMoveDirection enum values
37 *
38 * \sa TouchMoveDirection
39 */
40 unsigned int m_directions;
41 /*!
42 * \brief Whether a swipe gesture has been detected or not
43 */
44 bool m_swipeDetected = false;
45 /*!
46 * \brief Number of active pointers
47 */
48 unsigned int m_size = 0;
49 };