OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_EXO_POINTER_H_ | 5 #ifndef COMPONENTS_EXO_POINTER_H_ |
6 #define COMPONENTS_EXO_POINTER_H_ | 6 #define COMPONENTS_EXO_POINTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/exo/surface_delegate.h" | 11 #include "components/exo/surface_delegate.h" |
12 #include "components/exo/surface_observer.h" | 12 #include "components/exo/surface_observer.h" |
13 #include "ui/aura/client/cursor_client_observer.h" | 13 #include "components/exo/wm_helper.h" |
14 #include "ui/events/event_handler.h" | 14 #include "ui/events/event_handler.h" |
15 #include "ui/gfx/geometry/point.h" | 15 #include "ui/gfx/geometry/point.h" |
16 #include "ui/gfx/geometry/point_f.h" | 16 #include "ui/gfx/geometry/point_f.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 class Event; | 19 class Event; |
20 class MouseEvent; | 20 class MouseEvent; |
21 class MouseWheelEvent; | 21 class MouseWheelEvent; |
22 } | 22 } |
23 | 23 |
24 namespace views { | 24 namespace views { |
25 class Widget; | 25 class Widget; |
26 } | 26 } |
27 | 27 |
28 namespace exo { | 28 namespace exo { |
29 class PointerDelegate; | 29 class PointerDelegate; |
30 class PointerStylusDelegate; | 30 class PointerStylusDelegate; |
31 class Surface; | 31 class Surface; |
32 | 32 |
33 // This class implements a client pointer that represents one or more input | 33 // This class implements a client pointer that represents one or more input |
34 // devices, such as mice, which control the pointer location and pointer focus. | 34 // devices, such as mice, which control the pointer location and pointer focus. |
35 class Pointer : public ui::EventHandler, | 35 class Pointer : public ui::EventHandler, |
36 public aura::client::CursorClientObserver, | 36 public WMHelper::CursorObserver, |
37 public SurfaceDelegate, | 37 public SurfaceDelegate, |
38 public SurfaceObserver { | 38 public SurfaceObserver { |
39 public: | 39 public: |
40 explicit Pointer(PointerDelegate* delegate); | 40 explicit Pointer(PointerDelegate* delegate); |
41 ~Pointer() override; | 41 ~Pointer() override; |
42 | 42 |
43 // Set the pointer surface, i.e., the surface that contains the pointer image | 43 // Set the pointer surface, i.e., the surface that contains the pointer image |
44 // (cursor). The |hotspot| argument defines the position of the pointer | 44 // (cursor). The |hotspot| argument defines the position of the pointer |
45 // surface relative to the pointer location. Its top-left corner is always at | 45 // surface relative to the pointer location. Its top-left corner is always at |
46 // (x, y) - (hotspot.x, hotspot.y), where (x, y) are the coordinates of the | 46 // (x, y) - (hotspot.x, hotspot.y), where (x, y) are the coordinates of the |
47 // pointer location, in surface local coordinates. | 47 // pointer location, in surface local coordinates. |
48 void SetCursor(Surface* surface, const gfx::Point& hotspot); | 48 void SetCursor(Surface* surface, const gfx::Point& hotspot); |
49 | 49 |
50 // Set delegate for stylus events. | 50 // Set delegate for stylus events. |
51 void SetStylusDelegate(PointerStylusDelegate* delegate); | 51 void SetStylusDelegate(PointerStylusDelegate* delegate); |
52 | 52 |
53 // Overridden from ui::EventHandler: | 53 // Overridden from ui::EventHandler: |
54 void OnMouseEvent(ui::MouseEvent* event) override; | 54 void OnMouseEvent(ui::MouseEvent* event) override; |
55 void OnScrollEvent(ui::ScrollEvent* event) override; | 55 void OnScrollEvent(ui::ScrollEvent* event) override; |
56 | 56 |
57 // Overridden from aura::client::CursorClientObserver: | 57 // Overridden from WMHelper::CursorObserver: |
58 void OnCursorSetChanged(ui::CursorSetType cursor_set) override; | 58 void OnCursorSetChanged(ui::CursorSetType cursor_set) override; |
59 | 59 |
60 // Overridden from SurfaceDelegate: | 60 // Overridden from SurfaceDelegate: |
61 void OnSurfaceCommit() override; | 61 void OnSurfaceCommit() override; |
62 bool IsSurfaceSynchronized() const override; | 62 bool IsSurfaceSynchronized() const override; |
63 | 63 |
64 // Overridden from SurfaceObserver: | 64 // Overridden from SurfaceObserver: |
65 void OnSurfaceDestroying(Surface* surface) override; | 65 void OnSurfaceDestroying(Surface* surface) override; |
66 | 66 |
67 private: | 67 private: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // The current pointer force. | 107 // The current pointer force. |
108 float force_; | 108 float force_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(Pointer); | 110 DISALLOW_COPY_AND_ASSIGN(Pointer); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace exo | 113 } // namespace exo |
114 | 114 |
115 #endif // COMPONENTS_EXO_POINTER_H_ | 115 #endif // COMPONENTS_EXO_POINTER_H_ |
OLD | NEW |