| 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_VIEWS_EVENTS_EVENT_H_ | 5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
| 6 #define UI_VIEWS_EVENTS_EVENT_H_ | 6 #define UI_VIEWS_EVENTS_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "ui/base/events.h" | 10 #include "ui/base/events.h" |
| 11 #include "ui/base/keycodes/keyboard_codes.h" | 11 #include "ui/base/keycodes/keyboard_codes.h" |
| 12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 13 #include "ui/views/native_types.h" | |
| 14 | 13 |
| 15 class OSExchangeData; | 14 class OSExchangeData; |
| 16 | 15 |
| 17 namespace ui { | 16 namespace ui { |
| 18 | 17 |
| 19 class View; | 18 class View; |
| 20 | 19 |
| 21 class Event { | 20 class Event { |
| 22 public: | 21 public: |
| 23 EventType type() const { return type_; } | 22 EventType type() const { return type_; } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 LocatedEvent(const LocatedEvent& other, View* source, View* target); | 74 LocatedEvent(const LocatedEvent& other, View* source, View* target); |
| 76 | 75 |
| 77 private: | 76 private: |
| 78 gfx::Point location_; | 77 gfx::Point location_; |
| 79 | 78 |
| 80 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); | 79 DISALLOW_COPY_AND_ASSIGN(LocatedEvent); |
| 81 }; | 80 }; |
| 82 | 81 |
| 83 class MouseEvent : public LocatedEvent { | 82 class MouseEvent : public LocatedEvent { |
| 84 public: | 83 public: |
| 85 explicit MouseEvent(NativeEvent native_event); | 84 explicit MouseEvent(const ui::NativeEvent& native_event); |
| 86 | 85 |
| 87 MouseEvent(const MouseEvent& other, View* source, View* target); | 86 MouseEvent(const MouseEvent& other, View* source, View* target); |
| 88 | 87 |
| 89 // Conveniences to quickly test what button is down: | 88 // Conveniences to quickly test what button is down: |
| 90 bool IsOnlyLeftMouseButton() const { | 89 bool IsOnlyLeftMouseButton() const { |
| 91 return (flags() & EF_LEFT_BUTTON_DOWN) && | 90 return (flags() & EF_LEFT_BUTTON_DOWN) && |
| 92 !(flags() & (EF_MIDDLE_BUTTON_DOWN | EF_RIGHT_BUTTON_DOWN)); | 91 !(flags() & (EF_MIDDLE_BUTTON_DOWN | EF_RIGHT_BUTTON_DOWN)); |
| 93 } | 92 } |
| 94 bool IsLeftMouseButton() const { | 93 bool IsLeftMouseButton() const { |
| 95 return (flags() & EF_LEFT_BUTTON_DOWN) != 0; | 94 return (flags() & EF_LEFT_BUTTON_DOWN) != 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 108 bool IsRightMouseButton() const { | 107 bool IsRightMouseButton() const { |
| 109 return (flags() & EF_RIGHT_BUTTON_DOWN) != 0; | 108 return (flags() & EF_RIGHT_BUTTON_DOWN) != 0; |
| 110 } | 109 } |
| 111 | 110 |
| 112 private: | 111 private: |
| 113 DISALLOW_COPY_AND_ASSIGN(MouseEvent); | 112 DISALLOW_COPY_AND_ASSIGN(MouseEvent); |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 class KeyEvent : public Event { | 115 class KeyEvent : public Event { |
| 117 public: | 116 public: |
| 118 explicit KeyEvent(NativeEvent native_event); | 117 explicit KeyEvent(const ui::NativeEvent& native_event); |
| 119 | 118 |
| 120 KeyboardCode key_code() const { return key_code_; } | 119 KeyboardCode key_code() const { return key_code_; } |
| 121 | 120 |
| 122 int repeat_count() const { return repeat_count_; } | |
| 123 | |
| 124 private: | 121 private: |
| 125 KeyboardCode key_code_; | 122 KeyboardCode key_code_; |
| 126 int repeat_count_; | |
| 127 int message_flags_; | |
| 128 | 123 |
| 129 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | 124 DISALLOW_COPY_AND_ASSIGN(KeyEvent); |
| 130 }; | 125 }; |
| 131 | 126 |
| 132 class MouseWheelEvent : public LocatedEvent { | 127 class MouseWheelEvent : public LocatedEvent { |
| 133 public: | 128 public: |
| 134 explicit MouseWheelEvent(NativeEvent native_event); | 129 explicit MouseWheelEvent(const ui::NativeEvent& native_event); |
| 135 | 130 |
| 136 int offset() const { return offset_; } | 131 int offset() const { return offset_; } |
| 137 | 132 |
| 138 private: | 133 private: |
| 139 int offset_; | 134 int offset_; |
| 140 | 135 |
| 141 DISALLOW_COPY_AND_ASSIGN(MouseWheelEvent); | 136 DISALLOW_COPY_AND_ASSIGN(MouseWheelEvent); |
| 142 }; | 137 }; |
| 143 | 138 |
| 144 /* | 139 /* |
| 145 class DropTargetEvent : public LocatedEvent { | 140 class DropTargetEvent : public LocatedEvent { |
| 146 public: | 141 public: |
| 147 explicit DropTargetEvent(NativeEvent native_event); | 142 explicit DropTargetEvent(const ui::NativeEvent& native_event); |
| 148 | 143 |
| 149 const OSExchangeData& data() const { return data_; } | 144 const OSExchangeData& data() const { return data_; } |
| 150 int source_operations() const { return source_operations_; } | 145 int source_operations() const { return source_operations_; } |
| 151 | 146 |
| 152 private: | 147 private: |
| 153 const OSExchangeData& data_; | 148 const OSExchangeData& data_; |
| 154 int source_operations_; | 149 int source_operations_; |
| 155 | 150 |
| 156 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); | 151 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); |
| 157 }; | 152 }; |
| 158 */ | 153 */ |
| 159 | 154 |
| 160 } // namespace ui | 155 } // namespace ui |
| 161 | 156 |
| 162 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 157 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |