Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: ui/events/gesture_detection/motion_event.h

Issue 128613003: [Tracking Patch] Unified gesture detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address tdresser@ comments and run clang-format on everything Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
6 #define UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h"
11
12 namespace ui {
13
14 // Abstract class for a generic motion-related event, patterned after that
15 // subset of Android's MotionEvent API used in gesture detection.
16 class GESTURE_DETECTION_EXPORT MotionEvent {
17 public:
18 enum Action {
19 ACTION_POINTER_DOWN,
20 ACTION_POINTER_UP,
21 ACTION_DOWN,
22 ACTION_UP,
23 ACTION_CANCEL,
24 ACTION_MOVE
25 };
26
27 virtual ~MotionEvent() {}
28
29 virtual Action GetAction() const = 0;
30 virtual int GetActionIndex() const = 0;
31 virtual size_t GetPointerCount() const = 0;
32 virtual int GetPointerId(size_t pointer_index) const = 0;
33 virtual float GetX(size_t pointer_index) const = 0;
34 virtual float GetY(size_t pointer_index) const = 0;
35 virtual float GetTouchMajor(size_t pointer_index) const = 0;
36 virtual base::TimeTicks GetEventTime() const = 0;
37
38 virtual size_t GetHistorySize() const = 0;
39 virtual base::TimeTicks GetHistoricalEventTime(
40 size_t historical_index) const = 0;
41 virtual float GetHistoricalTouchMajor(size_t pointer_index,
42 size_t historical_index) const = 0;
43 virtual float GetHistoricalX(size_t pointer_index,
44 size_t historical_index) const = 0;
45 virtual float GetHistoricalY(size_t pointer_index,
46 size_t historical_index) const = 0;
47
48 virtual scoped_ptr<MotionEvent> Clone() const = 0;
49 virtual scoped_ptr<MotionEvent> Cancel() const = 0;
50
51 // Utility accessor methods for convenience.
52 float GetX() const { return GetX(0); }
53 float GetY() const { return GetY(0); }
54 float GetRawX() const { return GetX(); }
55 float GetRawY() const { return GetY(); }
56 float GetTouchMajor() const { return GetTouchMajor(0); }
57 };
58
59 } // namespace ui
60
61 #endif // UI_EVENTS_GESTURE_DETECTION_MOTION_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698