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

Side by Side Diff: ui/base/gestures/gesture_types.h

Issue 10831240: Remove TouchEvent interface, and rename TouchEventImpl to TouchEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge-tot Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/gestures/gesture_sequence.cc ('k') | ui/views/events/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_BASE_GESTURES_GESTURE_TYPES_H_ 5 #ifndef UI_BASE_GESTURES_GESTURE_TYPES_H_
6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_ 6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "ui/base/events.h" 10 #include "ui/base/events.h"
11 #include "ui/gfx/rect.h" 11 #include "ui/gfx/rect.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 class TouchEvent;
16
15 struct UI_EXPORT GestureEventDetails { 17 struct UI_EXPORT GestureEventDetails {
16 public: 18 public:
17 GestureEventDetails(EventType type, float delta_x, float delta_y); 19 GestureEventDetails(EventType type, float delta_x, float delta_y);
18 20
19 EventType type() const { return type_; } 21 EventType type() const { return type_; }
20 22
21 int touch_points() const { return touch_points_; } 23 int touch_points() const { return touch_points_; }
22 void set_touch_points(int touch_points) { touch_points_ = touch_points; } 24 void set_touch_points(int touch_points) { touch_points_ = touch_points; }
23 25
24 const gfx::Rect& bounding_box() const { return bounding_box_; } 26 const gfx::Rect& bounding_box() const { return bounding_box_; }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } generic; 108 } generic;
107 } data; 109 } data;
108 110
109 int touch_points_; // Number of active touch points in the gesture. 111 int touch_points_; // Number of active touch points in the gesture.
110 112
111 // Bounding box is an axis-aligned rectangle that contains all the 113 // Bounding box is an axis-aligned rectangle that contains all the
112 // enclosing rectangles of the touch-points in the gesture. 114 // enclosing rectangles of the touch-points in the gesture.
113 gfx::Rect bounding_box_; 115 gfx::Rect bounding_box_;
114 }; 116 };
115 117
116 // An abstract type to represent touch-events. The gesture-recognizer uses this
117 // interface to communicate with the touch-events.
118 class UI_EXPORT TouchEvent {
119 public:
120 virtual ~TouchEvent() {}
121
122 virtual EventType GetEventType() const = 0;
123 virtual gfx::Point GetLocation() const = 0;
124 virtual int GetTouchId() const = 0;
125 virtual int GetEventFlags() const = 0;
126 virtual base::TimeDelta GetTimestamp() const = 0;
127 virtual float RadiusX() const = 0;
128 virtual float RadiusY() const = 0;
129 virtual float RotationAngle() const = 0;
130 virtual float Force() const = 0;
131 };
132
133 // An abstract type to represent gesture-events. 118 // An abstract type to represent gesture-events.
134 class UI_EXPORT GestureEvent { 119 class UI_EXPORT GestureEvent {
135 public: 120 public:
136 virtual ~GestureEvent() {} 121 virtual ~GestureEvent() {}
137 122
138 // A gesture event can have multiple touches. This function should return the 123 // A gesture event can have multiple touches. This function should return the
139 // lowest ID of the touches in this gesture. 124 // lowest ID of the touches in this gesture.
140 virtual int GetLowestTouchId() const = 0; 125 virtual int GetLowestTouchId() const = 0;
141 126
142 // A helper function used in several (all) derived classes. 127 // A helper function used in several (all) derived classes.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 165
181 // |flags| is ui::EventFlags. The meaning of |param_first| and |param_second| 166 // |flags| is ui::EventFlags. The meaning of |param_first| and |param_second|
182 // depends on the specific gesture type (|type|). 167 // depends on the specific gesture type (|type|).
183 virtual GestureEvent* CreateGestureEvent(const GestureEventDetails& details, 168 virtual GestureEvent* CreateGestureEvent(const GestureEventDetails& details,
184 const gfx::Point& location, 169 const gfx::Point& location,
185 int flags, 170 int flags,
186 base::Time time, 171 base::Time time,
187 unsigned int touch_id_bitfield) = 0; 172 unsigned int touch_id_bitfield) = 0;
188 173
189 virtual TouchEvent* CreateTouchEvent(EventType type, 174 virtual TouchEvent* CreateTouchEvent(EventType type,
190 const gfx::Point& location, 175 const gfx::Point& location,
191 int touch_id, 176 int touch_id,
192 base::TimeDelta time_stamp) = 0; 177 base::TimeDelta time_stamp) = 0;
193 178
194 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; 179 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0;
195 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; 180 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0;
196 }; 181 };
197 182
198 } // namespace ui 183 } // namespace ui
199 184
200 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ 185 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_
OLDNEW
« no previous file with comments | « ui/base/gestures/gesture_sequence.cc ('k') | ui/views/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698