OLD | NEW |
1 | 1 |
2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #ifndef UI_VIEWS_EVENTS_EVENT_H_ | 6 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
7 #define UI_VIEWS_EVENTS_EVENT_H_ | 7 #define UI_VIEWS_EVENTS_EVENT_H_ |
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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 //////////////////////////////////////////////////////////////////////////////// | 213 //////////////////////////////////////////////////////////////////////////////// |
214 // | 214 // |
215 // TouchEvent class | 215 // TouchEvent class |
216 // | 216 // |
217 // A touch event is generated by touch screen and advanced track | 217 // A touch event is generated by touch screen and advanced track |
218 // pad devices. There is a deliberate direct correspondence between | 218 // pad devices. There is a deliberate direct correspondence between |
219 // TouchEvent and PlatformTouchPoint. | 219 // TouchEvent and PlatformTouchPoint. |
220 // | 220 // |
221 //////////////////////////////////////////////////////////////////////////////// | 221 //////////////////////////////////////////////////////////////////////////////// |
222 class VIEWS_EXPORT TouchEvent : public LocatedEvent, | 222 class VIEWS_EXPORT TouchEvent : public LocatedEvent { |
223 public ui::TouchEvent { | |
224 public: | 223 public: |
225 explicit TouchEvent(const NativeEvent& native_event); | 224 explicit TouchEvent(const NativeEvent& native_event); |
226 | 225 |
227 // Create a new touch event. | 226 // Create a new touch event. |
228 TouchEvent(ui::EventType type, | 227 TouchEvent(ui::EventType type, |
229 int x, | 228 int x, |
230 int y, | 229 int y, |
231 int flags, | 230 int flags, |
232 int touch_id, | 231 int touch_id, |
233 float radius_x, | 232 float radius_x, |
234 float radius_y, | 233 float radius_y, |
235 float angle, | 234 float angle, |
236 float force); | 235 float force); |
237 | 236 |
238 // Create a new TouchEvent which is identical to the provided model. | 237 // Create a new TouchEvent which is identical to the provided model. |
239 // If source / target views are provided, the model location will be converted | 238 // If source / target views are provided, the model location will be converted |
240 // from |source| coordinate system to |target| coordinate system. | 239 // from |source| coordinate system to |target| coordinate system. |
241 TouchEvent(const TouchEvent& model, View* source, View* target); | 240 TouchEvent(const TouchEvent& model, View* source, View* target); |
242 | 241 |
243 virtual ~TouchEvent(); | 242 virtual ~TouchEvent(); |
244 | 243 |
245 int identity() const { return touch_id_; } | 244 int identity() const { return touch_id_; } |
246 | 245 |
247 float radius_x() const { return radius_x_; } | 246 float radius_x() const { return radius_x_; } |
248 float radius_y() const { return radius_y_; } | 247 float radius_y() const { return radius_y_; } |
249 float rotation_angle() const { return rotation_angle_; } | 248 float rotation_angle() const { return rotation_angle_; } |
250 float force() const { return force_; } | 249 float force() const { return force_; } |
251 | 250 |
252 // Overridden from ui::TouchEvent. | |
253 virtual ui::EventType GetEventType() const OVERRIDE; | |
254 virtual gfx::Point GetLocation() const OVERRIDE; | |
255 virtual int GetTouchId() const OVERRIDE; | |
256 virtual int GetEventFlags() const OVERRIDE; | |
257 virtual base::TimeDelta GetTimestamp() const OVERRIDE; | |
258 virtual float RadiusX() const OVERRIDE; | |
259 virtual float RadiusY() const OVERRIDE; | |
260 virtual float RotationAngle() const OVERRIDE; | |
261 virtual float Force() const OVERRIDE; | |
262 | |
263 private: | 251 private: |
264 friend class internal::RootView; | 252 friend class internal::RootView; |
265 | 253 |
266 TouchEvent(const TouchEvent& model, View* root); | 254 TouchEvent(const TouchEvent& model, View* root); |
267 | 255 |
268 // The identity (typically finger) of the touch starting at 0 and incrementing | 256 // The identity (typically finger) of the touch starting at 0 and incrementing |
269 // for each separable additional touch that the hardware can detect. | 257 // for each separable additional touch that the hardware can detect. |
270 const int touch_id_; | 258 const int touch_id_; |
271 | 259 |
272 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. | 260 // Radius of the X (major) axis of the touch ellipse. 1.0 if unknown. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 float x_offset_; | 358 float x_offset_; |
371 float y_offset_; | 359 float y_offset_; |
372 | 360 |
373 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); | 361 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); |
374 }; | 362 }; |
375 | 363 |
376 //////////////////////////////////////////////////////////////////////////////// | 364 //////////////////////////////////////////////////////////////////////////////// |
377 // GestureEvent class | 365 // GestureEvent class |
378 // | 366 // |
379 //////////////////////////////////////////////////////////////////////////////// | 367 //////////////////////////////////////////////////////////////////////////////// |
380 class VIEWS_EXPORT GestureEvent : public LocatedEvent, | 368 class VIEWS_EXPORT GestureEvent : public LocatedEvent { |
381 public ui::GestureEvent { | |
382 public: | 369 public: |
383 explicit GestureEvent(const NativeEvent& native_event); | 370 explicit GestureEvent(const NativeEvent& native_event); |
384 | 371 |
385 // Create a new GestureEvent which is identical to the provided model. | 372 // Create a new GestureEvent which is identical to the provided model. |
386 // If source / target views are provided, the model location will be converted | 373 // If source / target views are provided, the model location will be converted |
387 // from |source| coordinate system to |target| coordinate system. | 374 // from |source| coordinate system to |target| coordinate system. |
388 GestureEvent(const GestureEvent& model, View* source, View* target); | 375 GestureEvent(const GestureEvent& model, View* source, View* target); |
389 | 376 |
390 virtual ~GestureEvent(); | 377 virtual ~GestureEvent(); |
391 | 378 |
392 const ui::GestureEventDetails& details() const { return details_; } | 379 const ui::GestureEventDetails& details() const { return details_; } |
393 | 380 |
394 protected: | 381 protected: |
395 GestureEvent(ui::EventType type, int x, int y, int flags); | 382 GestureEvent(ui::EventType type, int x, int y, int flags); |
396 | 383 |
397 private: | 384 private: |
398 friend class internal::RootView; | 385 friend class internal::RootView; |
399 | 386 |
400 GestureEvent(const GestureEvent& model, View* root); | 387 GestureEvent(const GestureEvent& model, View* root); |
401 | 388 |
402 // Overridden from ui::GestureEvent. | |
403 virtual int GetLowestTouchId() const OVERRIDE; | |
404 | |
405 ui::GestureEventDetails details_; | 389 ui::GestureEventDetails details_; |
406 | 390 |
407 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 391 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
408 }; | 392 }; |
409 | 393 |
410 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { | 394 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { |
411 public: | 395 public: |
412 GestureEventForTest(ui::EventType type, int x, int y, int flags); | 396 GestureEventForTest(ui::EventType type, int x, int y, int flags); |
413 | 397 |
414 private: | 398 private: |
415 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); | 399 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); |
416 }; | 400 }; |
417 | 401 |
418 #if defined(OS_WIN) | 402 #if defined(OS_WIN) |
419 int GetModifiersFromKeyState(); | 403 int GetModifiersFromKeyState(); |
420 #endif | 404 #endif |
421 | 405 |
422 } // namespace views | 406 } // namespace views |
423 | 407 |
424 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 408 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
OLD | NEW |