summaryrefslogtreecommitdiffstats
path: root/xbmc/input/touch/ITouchInputHandling.cpp
blob: e799f72467fcdb2f6819b8dfca1b7ab368a9fdec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/*
 *  Copyright (C) 2012-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "ITouchInputHandling.h"

void ITouchInputHandling::RegisterHandler(ITouchActionHandler* touchHandler)
{
  m_handler = touchHandler;
}

void ITouchInputHandling::UnregisterHandler()
{
  m_handler = NULL;
}

void ITouchInputHandling::OnTouchAbort()
{
  if (m_handler)
    m_handler->OnTouchAbort();
}

bool ITouchInputHandling::OnSingleTouchStart(float x, float y)
{
  if (m_handler)
    return m_handler->OnSingleTouchStart(x, y);

  return true;
}

bool ITouchInputHandling::OnSingleTouchHold(float x, float y)
{
  if (m_handler)
    return m_handler->OnSingleTouchHold(x, y);

  return true;
}

bool ITouchInputHandling::OnSingleTouchMove(
    float x, float y, float offsetX, float offsetY, float velocityX, float velocityY)
{
  if (m_handler)
    return m_handler->OnSingleTouchMove(x, y, offsetX, offsetY, velocityX, velocityY);

  return true;
}

bool ITouchInputHandling::OnSingleTouchEnd(float x, float y)
{
  if (m_handler)
    return m_handler->OnSingleTouchEnd(x, y);

  return true;
}

bool ITouchInputHandling::OnMultiTouchDown(float x, float y, int32_t pointer)
{
  if (m_handler)
    return m_handler->OnMultiTouchDown(x, y, pointer);

  return true;
}

bool ITouchInputHandling::OnMultiTouchHold(float x, float y, int32_t pointers /* = 2 */)
{
  if (m_handler)
    return m_handler->OnMultiTouchHold(x, y, pointers);

  return true;
}

bool ITouchInputHandling::OnMultiTouchMove(float x,
                                           float y,
                                           float offsetX,
                                           float offsetY,
                                           float velocityX,
                                           float velocityY,
                                           int32_t pointer)
{
  if (m_handler)
    return m_handler->OnMultiTouchMove(x, y, offsetX, offsetY, velocityX, velocityY, pointer);

  return true;
}

bool ITouchInputHandling::OnMultiTouchUp(float x, float y, int32_t pointer)
{
  if (m_handler)
    return m_handler->OnMultiTouchUp(x, y, pointer);

  return true;
}

bool ITouchInputHandling::OnTouchGestureStart(float x, float y)
{
  if (m_handler)
    return m_handler->OnTouchGestureStart(x, y);

  return true;
}

bool ITouchInputHandling::OnTouchGesturePan(
    float x, float y, float offsetX, float offsetY, float velocityX, float velocityY)
{
  if (m_handler)
    return m_handler->OnTouchGesturePan(x, y, offsetX, offsetY, velocityX, velocityY);

  return true;
}

bool ITouchInputHandling::OnTouchGestureEnd(
    float x, float y, float offsetX, float offsetY, float velocityX, float velocityY)
{
  if (m_handler)
    return m_handler->OnTouchGestureEnd(x, y, offsetX, offsetY, velocityX, velocityY);

  return true;
}

void ITouchInputHandling::OnTap(float x, float y, int32_t pointers /* = 1 */)
{
  if (m_handler)
    m_handler->OnTap(x, y, pointers);
}

void ITouchInputHandling::OnLongPress(float x, float y, int32_t pointers /* = 1 */)
{
  if (m_handler)
    m_handler->OnLongPress(x, y, pointers);
}

void ITouchInputHandling::OnSwipe(TouchMoveDirection direction,
                                  float xDown,
                                  float yDown,
                                  float xUp,
                                  float yUp,
                                  float velocityX,
                                  float velocityY,
                                  int32_t pointers /* = 1 */)
{
  if (m_handler)
    m_handler->OnSwipe(direction, xDown, yDown, xUp, yUp, velocityX, velocityY, pointers);
}

void ITouchInputHandling::OnZoomPinch(float centerX, float centerY, float zoomFactor)
{
  if (m_handler)
    m_handler->OnZoomPinch(centerX, centerY, zoomFactor);
}

void ITouchInputHandling::OnRotate(float centerX, float centerY, float angle)
{
  if (m_handler)
    m_handler->OnRotate(centerX, centerY, angle);
}