OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ | 5 #ifndef ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ | 6 #define ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ui/aura/event_filter.h" | 10 #include "ui/aura/event_filter.h" |
11 #include "ui/gfx/point.h" | 11 #include "ui/gfx/point.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class MouseEvent; | 14 class MouseEvent; |
15 class KeyEvent; | 15 class KeyEvent; |
16 class Window; | 16 class Window; |
17 } | 17 } |
18 | 18 |
19 namespace views { | 19 namespace views { |
20 class Label; | 20 class Label; |
21 class Widget; | 21 class Widget; |
22 } | 22 } |
23 | 23 |
24 namespace ash { | 24 namespace ash { |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
| 27 class TouchHudCanvas; |
| 28 |
27 // An event filter which handles system level gesture events. | 29 // An event filter which handles system level gesture events. |
28 class TouchObserverHUD : public aura::EventFilter { | 30 class TouchObserverHUD : public aura::EventFilter { |
29 public: | 31 public: |
30 TouchObserverHUD(); | 32 TouchObserverHUD(); |
31 virtual ~TouchObserverHUD(); | 33 virtual ~TouchObserverHUD(); |
32 | 34 |
33 private: | 35 private: |
34 void UpdateTouchPointLabel(int index); | 36 void UpdateTouchPointLabel(int index); |
35 | 37 |
36 // Overriden from aura::EventFilter: | 38 // Overriden from aura::EventFilter: |
37 virtual bool PreHandleKeyEvent(aura::Window* target, | 39 virtual bool PreHandleKeyEvent(aura::Window* target, |
38 aura::KeyEvent* event) OVERRIDE; | 40 aura::KeyEvent* event) OVERRIDE; |
39 virtual bool PreHandleMouseEvent(aura::Window* target, | 41 virtual bool PreHandleMouseEvent(aura::Window* target, |
40 aura::MouseEvent* event) OVERRIDE; | 42 aura::MouseEvent* event) OVERRIDE; |
41 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 43 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
42 aura::TouchEvent* event) OVERRIDE; | 44 aura::TouchEvent* event) OVERRIDE; |
43 virtual ui::GestureStatus PreHandleGestureEvent( | 45 virtual ui::GestureStatus PreHandleGestureEvent( |
44 aura::Window* target, | 46 aura::Window* target, |
45 aura::GestureEvent* event) OVERRIDE; | 47 aura::GestureEvent* event) OVERRIDE; |
46 | 48 |
47 static const int kMaxTouchPoints = 32; | 49 static const int kMaxTouchPoints = 32; |
| 50 |
48 scoped_ptr<views::Widget> widget_; | 51 scoped_ptr<views::Widget> widget_; |
| 52 TouchHudCanvas* canvas_; |
49 views::Label* touch_labels_[kMaxTouchPoints]; | 53 views::Label* touch_labels_[kMaxTouchPoints]; |
50 gfx::Point touch_positions_[kMaxTouchPoints]; | 54 gfx::Point touch_positions_[kMaxTouchPoints]; |
51 ui::EventType touch_status_[kMaxTouchPoints]; | 55 ui::EventType touch_status_[kMaxTouchPoints]; |
52 | 56 |
53 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD); | 57 DISALLOW_COPY_AND_ASSIGN(TouchObserverHUD); |
54 }; | 58 }; |
55 | 59 |
56 } // namespace internal | 60 } // namespace internal |
57 } // namespace ash | 61 } // namespace ash |
58 | 62 |
59 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ | 63 #endif // ASH_TOUCH_TOUCH_OBSERVER_HUD_H_ |
OLD | NEW |