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_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 class EVENTS_EXPORT LocatedEvent : public Event { | 241 class EVENTS_EXPORT LocatedEvent : public Event { |
242 public: | 242 public: |
243 virtual ~LocatedEvent(); | 243 virtual ~LocatedEvent(); |
244 | 244 |
245 float x() const { return location_.x(); } | 245 float x() const { return location_.x(); } |
246 float y() const { return location_.y(); } | 246 float y() const { return location_.y(); } |
247 void set_location(const gfx::PointF& location) { location_ = location; } | 247 void set_location(const gfx::PointF& location) { location_ = location; } |
248 // TODO(tdresser): Always return floating point location. See | 248 // TODO(tdresser): Always return floating point location. See |
249 // crbug.com/337824. | 249 // crbug.com/337824. |
250 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } | 250 gfx::Point location() const { return gfx::ToFlooredPoint(location_); } |
251 const gfx::PointF& location_f() const { return location_; } | 251 gfx::PointF location_f() const { return location_; } |
252 void set_root_location(const gfx::PointF& root_location) { | 252 void set_root_location(const gfx::PointF& root_location) { |
253 root_location_ = root_location; | 253 root_location_ = root_location; |
254 } | 254 } |
255 gfx::Point root_location() const { | 255 gfx::Point root_location() const { |
256 return gfx::ToFlooredPoint(root_location_); | 256 return gfx::ToFlooredPoint(root_location_); |
257 } | 257 } |
258 const gfx::PointF& root_location_f() const { | |
259 return root_location_; | |
260 } | |
261 | 258 |
262 // Transform the locations using |inverted_root_transform|. | 259 // Transform the locations using |inverted_root_transform|. |
263 // This is applied to both |location_| and |root_location_|. | 260 // This is applied to both |location_| and |root_location_|. |
264 virtual void UpdateForRootTransform( | 261 virtual void UpdateForRootTransform( |
265 const gfx::Transform& inverted_root_transform); | 262 const gfx::Transform& inverted_root_transform); |
266 | 263 |
267 template <class T> void ConvertLocationToTarget(T* source, T* target) { | 264 template <class T> void ConvertLocationToTarget(T* source, T* target) { |
268 if (!target || target == source) | 265 if (!target || target == source) |
269 return; | 266 return; |
270 // TODO(tdresser): Rewrite ConvertPointToTarget to use PointF. See | 267 // TODO(tdresser): Rewrite ConvertPointToTarget to use PointF. See |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // The set of indices of ones in the binary representation of | 670 // The set of indices of ones in the binary representation of |
674 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 671 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
675 // This value is stored as a bitfield because the number of touch ids varies, | 672 // This value is stored as a bitfield because the number of touch ids varies, |
676 // but we currently don't need more than 32 touches at a time. | 673 // but we currently don't need more than 32 touches at a time. |
677 const unsigned int touch_ids_bitfield_; | 674 const unsigned int touch_ids_bitfield_; |
678 }; | 675 }; |
679 | 676 |
680 } // namespace ui | 677 } // namespace ui |
681 | 678 |
682 #endif // UI_EVENTS_EVENT_H_ | 679 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |