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 UI_AURA_EVENT_H_ | 5 #ifndef UI_AURA_EVENT_H_ |
6 #define UI_AURA_EVENT_H_ | 6 #define UI_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" |
(...skipping 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 const NativeEvent& native_event() const { return native_event_; } | 32 const NativeEvent& native_event() const { return native_event_; } |
33 ui::EventType type() const { return type_; } | 33 ui::EventType type() const { return type_; } |
34 const base::Time& time_stamp() const { return time_stamp_; } | 34 const base::Time& time_stamp() const { return time_stamp_; } |
35 int flags() const { return flags_; } | 35 int flags() const { return flags_; } |
36 | 36 |
37 protected: | 37 protected: |
38 Event(ui::EventType type, int flags); | 38 Event(ui::EventType type, int flags); |
39 Event(NativeEvent native_event, ui::EventType type, int flags); | 39 Event(NativeEvent native_event, ui::EventType type, int flags); |
40 Event(const Event& copy); | 40 Event(const Event& copy); |
| 41 void set_type(ui::EventType type) { type_ = type; } |
41 | 42 |
42 private: | 43 private: |
43 void operator=(const Event&); | 44 void operator=(const Event&); |
44 | 45 |
45 // Safely initializes the native event members of this class. | 46 // Safely initializes the native event members of this class. |
46 void Init(); | 47 void Init(); |
47 void InitWithNativeEvent(NativeEvent native_event); | 48 void InitWithNativeEvent(NativeEvent native_event); |
48 | 49 |
49 NativeEvent native_event_; | 50 NativeEvent native_event_; |
50 ui::EventType type_; | 51 ui::EventType type_; |
(...skipping 25 matching lines...) Expand all Loading... |
76 }; | 77 }; |
77 | 78 |
78 class AURA_EXPORT MouseEvent : public LocatedEvent { | 79 class AURA_EXPORT MouseEvent : public LocatedEvent { |
79 public: | 80 public: |
80 explicit MouseEvent(NativeEvent native_event); | 81 explicit MouseEvent(NativeEvent native_event); |
81 | 82 |
82 // Create a new MouseEvent which is identical to the provided model. | 83 // Create a new MouseEvent which is identical to the provided model. |
83 // If source / target windows are provided, the model location will be | 84 // If source / target windows are provided, the model location will be |
84 // converted from |source| coordinate system to |target| coordinate system. | 85 // converted from |source| coordinate system to |target| coordinate system. |
85 MouseEvent(const MouseEvent& model, Window* source, Window* target); | 86 MouseEvent(const MouseEvent& model, Window* source, Window* target); |
| 87 MouseEvent(const MouseEvent& model, |
| 88 Window* source, |
| 89 Window* target, |
| 90 ui::EventType type); |
86 | 91 |
87 // Used for synthetic events in testing. | 92 // Used for synthetic events in testing. |
88 MouseEvent(ui::EventType type, const gfx::Point& location, int flags); | 93 MouseEvent(ui::EventType type, const gfx::Point& location, int flags); |
89 | 94 |
90 private: | 95 private: |
91 DISALLOW_COPY_AND_ASSIGN(MouseEvent); | 96 DISALLOW_COPY_AND_ASSIGN(MouseEvent); |
92 }; | 97 }; |
93 | 98 |
94 class AURA_EXPORT KeyEvent : public Event { | 99 class AURA_EXPORT KeyEvent : public Event { |
95 public: | 100 public: |
96 explicit KeyEvent(NativeEvent native_event); | 101 explicit KeyEvent(NativeEvent native_event); |
97 | 102 |
98 // Used for synthetic events in testing. | 103 // Used for synthetic events in testing. |
99 KeyEvent(ui::EventType type, | 104 KeyEvent(ui::EventType type, |
100 ui::KeyboardCode key_code, | 105 ui::KeyboardCode key_code, |
101 int flags); | 106 int flags); |
102 | 107 |
103 ui::KeyboardCode key_code() const { return key_code_; } | 108 ui::KeyboardCode key_code() const { return key_code_; } |
104 | 109 |
105 private: | 110 private: |
106 ui::KeyboardCode key_code_; | 111 ui::KeyboardCode key_code_; |
107 }; | 112 }; |
108 | 113 |
109 } // namespace aura | 114 } // namespace aura |
110 | 115 |
111 #endif // UI_AURA_EVENT_H_ | 116 #endif // UI_AURA_EVENT_H_ |
OLD | NEW |