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 | |
26 class Event { | 24 class Event { |
27 public: | 25 public: |
28 const NativeEvent& native_event() const { return native_event_; } | 26 const NativeEvent& native_event() const { return native_event_; } |
29 ui::EventType type() const { return type_; } | 27 ui::EventType type() const { return type_; } |
30 const base::Time& time_stamp() const { return time_stamp_; } | 28 const base::Time& time_stamp() const { return time_stamp_; } |
31 int flags() const { return flags_; } | 29 int flags() const { return flags_; } |
32 | 30 |
33 protected: | 31 protected: |
34 Event(ui::EventType type, int flags); | 32 Event(ui::EventType type, int flags); |
35 Event(NativeEvent native_event, ui::EventType type, int flags); | 33 Event(NativeEvent native_event, ui::EventType type, int flags); |
(...skipping 14 matching lines...) Expand all Loading... |
50 | 48 |
51 class LocatedEvent : public Event { | 49 class LocatedEvent : public Event { |
52 public: | 50 public: |
53 int x() const { return location_.x(); } | 51 int x() const { return location_.x(); } |
54 int y() const { return location_.y(); } | 52 int y() const { return location_.y(); } |
55 gfx::Point location() const { return location_; } | 53 gfx::Point location() const { return location_; } |
56 | 54 |
57 protected: | 55 protected: |
58 explicit LocatedEvent(NativeEvent native_event); | 56 explicit LocatedEvent(NativeEvent native_event); |
59 | 57 |
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 | |
65 gfx::Point location_; | 58 gfx::Point location_; |
66 | 59 |
67 private: | 60 private: |
68 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); | 61 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); |
69 }; | 62 }; |
70 | 63 |
71 class MouseEvent : public LocatedEvent { | 64 class MouseEvent : public LocatedEvent { |
72 public: | 65 public: |
73 explicit MouseEvent(NativeEvent native_event); | 66 explicit MouseEvent(NativeEvent native_event); |
74 | 67 |
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 | |
80 private: | 68 private: |
81 DISALLOW_COPY_AND_ASSIGN(MouseEvent); | 69 DISALLOW_COPY_AND_ASSIGN(MouseEvent); |
82 }; | 70 }; |
83 | 71 |
84 | 72 |
85 } // namespace aura | 73 } // namespace aura |
86 | 74 |
87 #endif // AURA_EVENT_H_ | 75 #endif // AURA_EVENT_H_ |
OLD | NEW |