| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 AURA_EVENT_H_ | 5 #ifndef AURA_EVENT_H_ |
| 6 #define AURA_EVENT_H_ | 6 #define AURA_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "ui/base/events.h" | 11 #include "ui/base/events.h" |
| 12 #include "ui/base/keycodes/keyboard_codes.h" | 12 #include "ui/base/keycodes/keyboard_codes.h" |
| 13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
| 14 | 14 |
| 15 namespace aura { | 15 namespace aura { |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 typedef MSG NativeEvent; | 18 typedef MSG NativeEvent; |
| 19 #elif defined(USE_X11) | 19 #elif defined(USE_X11) |
| 20 typedef union _XEvent XEvent; | 20 typedef union _XEvent XEvent; |
| 21 typedef XEvent* NativeEvent; | 21 typedef XEvent* NativeEvent; |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class Window; |
| 25 |
| 24 class Event { | 26 class Event { |
| 25 public: | 27 public: |
| 26 const NativeEvent& native_event() const { return native_event_; } | 28 const NativeEvent& native_event() const { return native_event_; } |
| 27 ui::EventType type() const { return type_; } | 29 ui::EventType type() const { return type_; } |
| 28 const base::Time& time_stamp() const { return time_stamp_; } | 30 const base::Time& time_stamp() const { return time_stamp_; } |
| 29 int flags() const { return flags_; } | 31 int flags() const { return flags_; } |
| 30 | 32 |
| 31 protected: | 33 protected: |
| 32 Event(ui::EventType type, int flags); | 34 Event(ui::EventType type, int flags); |
| 33 Event(NativeEvent native_event, ui::EventType type, int flags); | 35 Event(NativeEvent native_event, ui::EventType type, int flags); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 | 50 |
| 49 class LocatedEvent : public Event { | 51 class LocatedEvent : public Event { |
| 50 public: | 52 public: |
| 51 int x() const { return location_.x(); } | 53 int x() const { return location_.x(); } |
| 52 int y() const { return location_.y(); } | 54 int y() const { return location_.y(); } |
| 53 gfx::Point location() const { return location_; } | 55 gfx::Point location() const { return location_; } |
| 54 | 56 |
| 55 protected: | 57 protected: |
| 56 explicit LocatedEvent(NativeEvent native_event); | 58 explicit LocatedEvent(NativeEvent native_event); |
| 57 | 59 |
| 60 // Create a new LocatedEvent which is identical to the provided model. |
| 61 // If source / target windows are provided, the model location will be |
| 62 // converted from |source| coordinate system to |target| coordinate system. |
| 63 LocatedEvent(const LocatedEvent& model, Window* source, Window* target); |
| 64 |
| 58 gfx::Point location_; | 65 gfx::Point location_; |
| 59 | 66 |
| 60 private: | 67 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); | 68 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); |
| 62 }; | 69 }; |
| 63 | 70 |
| 64 class MouseEvent : public LocatedEvent { | 71 class MouseEvent : public LocatedEvent { |
| 65 public: | 72 public: |
| 66 explicit MouseEvent(NativeEvent native_event); | 73 explicit MouseEvent(NativeEvent native_event); |
| 67 | 74 |
| 75 // Create a new MouseEvent which is identical to the provided model. |
| 76 // If source / target windows are provided, the model location will be |
| 77 // converted from |source| coordinate system to |target| coordinate system. |
| 78 MouseEvent(const MouseEvent& model, Window* source, Window* target); |
| 79 |
| 68 private: | 80 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(MouseEvent); | 81 DISALLOW_COPY_AND_ASSIGN(MouseEvent); |
| 70 }; | 82 }; |
| 71 | 83 |
| 72 | 84 |
| 73 } // namespace aura | 85 } // namespace aura |
| 74 | 86 |
| 75 #endif // AURA_EVENT_H_ | 87 #endif // AURA_EVENT_H_ |
| OLD | NEW |