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_BASE_EVENT_H_ | 5 #ifndef UI_BASE_EVENT_H_ |
6 #define UI_BASE_EVENT_H_ | 6 #define UI_BASE_EVENT_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 virtual EventType GetEventType() const OVERRIDE; | 235 virtual EventType GetEventType() const OVERRIDE; |
236 virtual gfx::Point GetLocation() const OVERRIDE; | 236 virtual gfx::Point GetLocation() const OVERRIDE; |
237 virtual int GetTouchId() const OVERRIDE; | 237 virtual int GetTouchId() const OVERRIDE; |
238 virtual int GetEventFlags() const OVERRIDE; | 238 virtual int GetEventFlags() const OVERRIDE; |
239 virtual base::TimeDelta GetTimestamp() const OVERRIDE; | 239 virtual base::TimeDelta GetTimestamp() const OVERRIDE; |
240 virtual float RadiusX() const OVERRIDE; | 240 virtual float RadiusX() const OVERRIDE; |
241 virtual float RadiusY() const OVERRIDE; | 241 virtual float RadiusY() const OVERRIDE; |
242 virtual float RotationAngle() const OVERRIDE; | 242 virtual float RotationAngle() const OVERRIDE; |
243 virtual float Force() const OVERRIDE; | 243 virtual float Force() const OVERRIDE; |
244 | 244 |
| 245 protected: |
| 246 void set_radius(float radius_x, float radius_y) { |
| 247 radius_x_ = radius_x; |
| 248 radius_y_ = radius_y; |
| 249 } |
| 250 |
| 251 void set_rotation_angle(float rotation_angle) { |
| 252 rotation_angle_ = rotation_angle; |
| 253 } |
| 254 |
| 255 void set_force(float force) { force_ = force; } |
| 256 |
245 private: | 257 private: |
246 // The identity (typically finger) of the touch starting at 0 and incrementing | 258 // The identity (typically finger) of the touch starting at 0 and incrementing |
247 // for each separable additional touch that the hardware can detect. | 259 // for each separable additional touch that the hardware can detect. |
248 const int touch_id_; | 260 const int touch_id_; |
249 | 261 |
250 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. | 262 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. |
251 float radius_x_; | 263 float radius_x_; |
252 | 264 |
253 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 265 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
254 float radius_y_; | 266 float radius_y_; |
255 | 267 |
256 // Angle of the major axis away from the X axis. Default 0.0. | 268 // Angle of the major axis away from the X axis. Default 0.0. |
257 const float rotation_angle_; | 269 float rotation_angle_; |
258 | 270 |
259 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 271 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
260 const float force_; | 272 float force_; |
261 | 273 |
262 DISALLOW_COPY_AND_ASSIGN(TouchEventImpl); | 274 DISALLOW_COPY_AND_ASSIGN(TouchEventImpl); |
263 }; | 275 }; |
264 | 276 |
265 class UI_EXPORT KeyEvent : public Event { | 277 class UI_EXPORT KeyEvent : public Event { |
266 public: | 278 public: |
267 KeyEvent(const base::NativeEvent& native_event, bool is_char); | 279 KeyEvent(const base::NativeEvent& native_event, bool is_char); |
268 | 280 |
269 // Used for synthetic events in testing. | 281 // Used for synthetic events in testing. |
270 KeyEvent(EventType type, KeyboardCode key_code, int flags); | 282 KeyEvent(EventType type, KeyboardCode key_code, int flags); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // This value is stored as a bitfield because the number of touch ids varies, | 424 // This value is stored as a bitfield because the number of touch ids varies, |
413 // but we currently don't need more than 32 touches at a time. | 425 // but we currently don't need more than 32 touches at a time. |
414 const unsigned int touch_ids_bitfield_; | 426 const unsigned int touch_ids_bitfield_; |
415 | 427 |
416 DISALLOW_COPY_AND_ASSIGN(GestureEventImpl); | 428 DISALLOW_COPY_AND_ASSIGN(GestureEventImpl); |
417 }; | 429 }; |
418 | 430 |
419 } // namespace ui | 431 } // namespace ui |
420 | 432 |
421 #endif // UI_BASE_EVENT_H_ | 433 #endif // UI_BASE_EVENT_H_ |
OLD | NEW |