• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "ui/events/event.h"
6 #include "ui/events/event_constants.h"
7 #include "ui/events/event_utils.h"
8 
9 namespace ui {
10 
UpdateDeviceList()11 void UpdateDeviceList() { NOTIMPLEMENTED(); }
12 
EventTimeFromNative(const base::NativeEvent & native_event)13 base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
14   const ui::Event* event = static_cast<const ui::Event*>(native_event);
15   return event->time_stamp();
16 }
17 
EventFlagsFromNative(const base::NativeEvent & native_event)18 int EventFlagsFromNative(const base::NativeEvent& native_event) {
19   const ui::Event* event = static_cast<const ui::Event*>(native_event);
20   return event->flags();
21 }
22 
EventTypeFromNative(const base::NativeEvent & native_event)23 EventType EventTypeFromNative(const base::NativeEvent& native_event) {
24   const ui::Event* event = static_cast<const ui::Event*>(native_event);
25   return event->type();
26 }
27 
EventSystemLocationFromNative(const base::NativeEvent & native_event)28 gfx::Point EventSystemLocationFromNative(
29     const base::NativeEvent& native_event) {
30   const ui::LocatedEvent* e =
31       static_cast<const ui::LocatedEvent*>(native_event);
32   DCHECK(e->IsMouseEvent() || e->IsTouchEvent() || e->IsGestureEvent() ||
33          e->IsScrollEvent());
34   return e->location();
35 }
36 
EventLocationFromNative(const base::NativeEvent & native_event)37 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
38   return EventSystemLocationFromNative(native_event);
39 }
40 
GetChangedMouseButtonFlagsFromNative(const base::NativeEvent & native_event)41 int GetChangedMouseButtonFlagsFromNative(
42     const base::NativeEvent& native_event) {
43   const ui::MouseEvent* event =
44       static_cast<const ui::MouseEvent*>(native_event);
45   DCHECK(event->IsMouseEvent());
46   return event->changed_button_flags();
47 }
48 
KeyboardCodeFromNative(const base::NativeEvent & native_event)49 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) {
50   const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
51   DCHECK(event->IsKeyEvent());
52   return event->key_code();
53 }
54 
CodeFromNative(const base::NativeEvent & native_event)55 const char* CodeFromNative(const base::NativeEvent& native_event) {
56   const ui::KeyEvent* event = static_cast<const ui::KeyEvent*>(native_event);
57   DCHECK(event->IsKeyEvent());
58   return event->code().c_str();
59 }
60 
IsMouseEvent(const base::NativeEvent & native_event)61 bool IsMouseEvent(const base::NativeEvent& native_event) {
62   const ui::Event* e = static_cast<const ui::Event*>(native_event);
63   return e->IsMouseEvent();
64 }
65 
GetMouseWheelOffset(const base::NativeEvent & native_event)66 gfx::Vector2d GetMouseWheelOffset(const base::NativeEvent& native_event) {
67   const ui::MouseWheelEvent* event =
68       static_cast<const ui::MouseWheelEvent*>(native_event);
69   DCHECK(event->type() == ET_MOUSEWHEEL);
70   return event->offset();
71 }
72 
ClearTouchIdIfReleased(const base::NativeEvent & xev)73 void ClearTouchIdIfReleased(const base::NativeEvent& xev) {
74 }
75 
GetTouchId(const base::NativeEvent & native_event)76 int GetTouchId(const base::NativeEvent& native_event) {
77   const ui::TouchEvent* event =
78       static_cast<const ui::TouchEvent*>(native_event);
79   DCHECK(event->IsTouchEvent());
80   return event->touch_id();
81 }
82 
GetTouchRadiusX(const base::NativeEvent & native_event)83 float GetTouchRadiusX(const base::NativeEvent& native_event) {
84   const ui::TouchEvent* event =
85       static_cast<const ui::TouchEvent*>(native_event);
86   DCHECK(event->IsTouchEvent());
87   return event->radius_x();
88 }
89 
GetTouchRadiusY(const base::NativeEvent & native_event)90 float GetTouchRadiusY(const base::NativeEvent& native_event) {
91   const ui::TouchEvent* event =
92       static_cast<const ui::TouchEvent*>(native_event);
93   DCHECK(event->IsTouchEvent());
94   return event->radius_y();
95 }
96 
GetTouchAngle(const base::NativeEvent & native_event)97 float GetTouchAngle(const base::NativeEvent& native_event) {
98   const ui::TouchEvent* event =
99       static_cast<const ui::TouchEvent*>(native_event);
100   DCHECK(event->IsTouchEvent());
101   return event->rotation_angle();
102 }
103 
GetTouchForce(const base::NativeEvent & native_event)104 float GetTouchForce(const base::NativeEvent& native_event) {
105   const ui::TouchEvent* event =
106       static_cast<const ui::TouchEvent*>(native_event);
107   DCHECK(event->IsTouchEvent());
108   return event->force();
109 }
110 
GetScrollOffsets(const base::NativeEvent & native_event,float * x_offset,float * y_offset,float * x_offset_ordinal,float * y_offset_ordinal,int * finger_count)111 bool GetScrollOffsets(const base::NativeEvent& native_event,
112                       float* x_offset,
113                       float* y_offset,
114                       float* x_offset_ordinal,
115                       float* y_offset_ordinal,
116                       int* finger_count) {
117   NOTIMPLEMENTED();
118   return false;
119 }
120 
GetFlingData(const base::NativeEvent & native_event,float * vx,float * vy,float * vx_ordinal,float * vy_ordinal,bool * is_cancel)121 bool GetFlingData(const base::NativeEvent& native_event,
122                   float* vx,
123                   float* vy,
124                   float* vx_ordinal,
125                   float* vy_ordinal,
126                   bool* is_cancel) {
127   NOTIMPLEMENTED();
128   return false;
129 }
130 
GetGestureTimes(const base::NativeEvent & native_event,double * start_time,double * end_time)131 bool GetGestureTimes(const base::NativeEvent& native_event,
132                      double* start_time,
133                      double* end_time) {
134   *start_time = 0;
135   *end_time = 0;
136   return false;
137 }
138 
SetNaturalScroll(bool)139 void SetNaturalScroll(bool /* enabled */) { NOTIMPLEMENTED(); }
140 
IsNaturalScrollEnabled()141 bool IsNaturalScrollEnabled() { return false; }
142 
IsTouchpadEvent(const base::NativeEvent & event)143 bool IsTouchpadEvent(const base::NativeEvent& event) {
144   NOTIMPLEMENTED();
145   return false;
146 }
147 
IsNoopEvent(const base::NativeEvent & event)148 bool IsNoopEvent(const base::NativeEvent& event) {
149   NOTIMPLEMENTED();
150   return false;
151 }
152 
CreateNoopEvent()153 base::NativeEvent CreateNoopEvent() {
154   NOTIMPLEMENTED();
155   return NULL;
156 }
157 
GetModifiersFromKeyState()158 int GetModifiersFromKeyState() {
159   NOTIMPLEMENTED();
160   return 0;
161 }
162 
163 }  // namespace ui
164