| OLD | NEW |
| 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_AURA_EVENT_H_ | 5 #ifndef UI_AURA_EVENT_H_ |
| 6 #define UI_AURA_EVENT_H_ | 6 #define UI_AURA_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 LocatedEvent* located_event_; | 105 LocatedEvent* located_event_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 virtual ~LocatedEvent(); | 108 virtual ~LocatedEvent(); |
| 109 | 109 |
| 110 int x() const { return location_.x(); } | 110 int x() const { return location_.x(); } |
| 111 int y() const { return location_.y(); } | 111 int y() const { return location_.y(); } |
| 112 gfx::Point location() const { return location_; } | 112 gfx::Point location() const { return location_; } |
| 113 gfx::Point root_location() const { return root_location_; } | 113 gfx::Point root_location() const { return root_location_; } |
| 114 | 114 |
| 115 // Applies the |root_transform| to both |location_| and |root_location_|. | 115 // Applies |root_transform| to the event. |
| 116 void UpdateForRootTransform(const ui::Transform& root_transform); | 116 // This is applied to both |location_| and |root_location_|. |
| 117 virtual void UpdateForRootTransform(const ui::Transform& root_transform); |
| 117 | 118 |
| 118 protected: | 119 protected: |
| 119 explicit LocatedEvent(const base::NativeEvent& native_event); | 120 explicit LocatedEvent(const base::NativeEvent& native_event); |
| 120 | 121 |
| 121 // Create a new LocatedEvent which is identical to the provided model. | 122 // Create a new LocatedEvent which is identical to the provided model. |
| 122 // If source / target windows are provided, the model location will be | 123 // If source / target windows are provided, the model location will be |
| 123 // converted from |source| coordinate system to |target| coordinate system. | 124 // converted from |source| coordinate system to |target| coordinate system. |
| 124 LocatedEvent(const LocatedEvent& model, Window* source, Window* target); | 125 LocatedEvent(const LocatedEvent& model, Window* source, Window* target); |
| 125 | 126 |
| 126 // Used for synthetic events in testing. | 127 // Used for synthetic events in testing. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 base::TimeDelta time_stamp); | 198 base::TimeDelta time_stamp); |
| 198 | 199 |
| 199 virtual ~TouchEvent(); | 200 virtual ~TouchEvent(); |
| 200 | 201 |
| 201 int touch_id() const { return touch_id_; } | 202 int touch_id() const { return touch_id_; } |
| 202 float radius_x() const { return radius_x_; } | 203 float radius_x() const { return radius_x_; } |
| 203 float radius_y() const { return radius_y_; } | 204 float radius_y() const { return radius_y_; } |
| 204 float rotation_angle() const { return rotation_angle_; } | 205 float rotation_angle() const { return rotation_angle_; } |
| 205 float force() const { return force_; } | 206 float force() const { return force_; } |
| 206 | 207 |
| 208 // Overridden from LocatedEvent. |
| 209 virtual void UpdateForRootTransform( |
| 210 const ui::Transform& root_transform) OVERRIDE; |
| 211 |
| 207 // Overridden from ui::TouchEvent. | 212 // Overridden from ui::TouchEvent. |
| 208 virtual ui::EventType GetEventType() const OVERRIDE; | 213 virtual ui::EventType GetEventType() const OVERRIDE; |
| 209 virtual gfx::Point GetLocation() const OVERRIDE; | 214 virtual gfx::Point GetLocation() const OVERRIDE; |
| 210 virtual int GetTouchId() const OVERRIDE; | 215 virtual int GetTouchId() const OVERRIDE; |
| 211 virtual int GetEventFlags() const OVERRIDE; | 216 virtual int GetEventFlags() const OVERRIDE; |
| 212 virtual base::TimeDelta GetTimestamp() const OVERRIDE; | 217 virtual base::TimeDelta GetTimestamp() const OVERRIDE; |
| 213 virtual TouchEvent* Copy() const OVERRIDE; | 218 virtual TouchEvent* Copy() const OVERRIDE; |
| 214 | 219 |
| 215 private: | 220 private: |
| 216 // The identity (typically finger) of the touch starting at 0 and incrementing | 221 // The identity (typically finger) of the touch starting at 0 and incrementing |
| 217 // for each separable additional touch that the hardware can detect. | 222 // for each separable additional touch that the hardware can detect. |
| 218 const int touch_id_; | 223 const int touch_id_; |
| 219 | 224 |
| 220 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. | 225 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. |
| 221 const float radius_x_; | 226 float radius_x_; |
| 222 | 227 |
| 223 // Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown. | 228 // Radius of the Y (minor) axis of the touch ellipse. 1.0 if unknown. |
| 224 const float radius_y_; | 229 float radius_y_; |
| 225 | 230 |
| 226 // Angle of the major axis away from the X axis. Default 0.0. | 231 // Angle of the major axis away from the X axis. Default 0.0. |
| 227 const float rotation_angle_; | 232 const float rotation_angle_; |
| 228 | 233 |
| 229 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 234 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
| 230 const float force_; | 235 const float force_; |
| 231 | 236 |
| 232 DISALLOW_COPY_AND_ASSIGN(TouchEvent); | 237 DISALLOW_COPY_AND_ASSIGN(TouchEvent); |
| 233 }; | 238 }; |
| 234 | 239 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // Create a new TouchEvent which is identical to the provided model. | 366 // Create a new TouchEvent which is identical to the provided model. |
| 362 // If source / target windows are provided, the model location will be | 367 // If source / target windows are provided, the model location will be |
| 363 // converted from |source| coordinate system to |target| coordinate system. | 368 // converted from |source| coordinate system to |target| coordinate system. |
| 364 GestureEvent(const GestureEvent& model, Window* source, Window* target); | 369 GestureEvent(const GestureEvent& model, Window* source, Window* target); |
| 365 | 370 |
| 366 virtual ~GestureEvent(); | 371 virtual ~GestureEvent(); |
| 367 | 372 |
| 368 float delta_x() const { return delta_x_; } | 373 float delta_x() const { return delta_x_; } |
| 369 float delta_y() const { return delta_y_; } | 374 float delta_y() const { return delta_y_; } |
| 370 | 375 |
| 376 // Overridden from LocatedEvent. |
| 377 virtual void UpdateForRootTransform( |
| 378 const ui::Transform& root_transform) OVERRIDE; |
| 379 |
| 371 // Returns the lowest touch-id of any of the touches which make up this | 380 // Returns the lowest touch-id of any of the touches which make up this |
| 372 // gesture. | 381 // gesture. |
| 373 // If there are no touches associated with this gesture, returns -1. | 382 // If there are no touches associated with this gesture, returns -1. |
| 374 virtual int GetLowestTouchId() const OVERRIDE; | 383 virtual int GetLowestTouchId() const OVERRIDE; |
| 375 | 384 |
| 376 private: | 385 private: |
| 377 float delta_x_; | 386 float delta_x_; |
| 378 float delta_y_; | 387 float delta_y_; |
| 379 | 388 |
| 380 // The set of indices of ones in the binary representation of | 389 // The set of indices of ones in the binary representation of |
| 381 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 390 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 382 // This value is stored as a bitfield because the number of touch ids varies, | 391 // This value is stored as a bitfield because the number of touch ids varies, |
| 383 // but we currently don't need more than 32 touches at a time. | 392 // but we currently don't need more than 32 touches at a time. |
| 384 const unsigned int touch_ids_bitfield_; | 393 const unsigned int touch_ids_bitfield_; |
| 385 | 394 |
| 386 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 395 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
| 387 }; | 396 }; |
| 388 | 397 |
| 389 } // namespace aura | 398 } // namespace aura |
| 390 | 399 |
| 391 #endif // UI_AURA_EVENT_H_ | 400 #endif // UI_AURA_EVENT_H_ |
| OLD | NEW |