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 UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 5 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 #include "ui/aura/window_delegate.h" | 11 #include "ui/aura/window_delegate.h" |
| 12 #include "ui/gfx/rect.h" |
12 | 13 |
13 namespace aura { | 14 namespace aura { |
14 namespace test { | 15 namespace test { |
15 | 16 |
16 // WindowDelegate implementation with all methods stubbed out. | 17 // WindowDelegate implementation with all methods stubbed out. |
17 class TestWindowDelegate : public WindowDelegate { | 18 class TestWindowDelegate : public WindowDelegate { |
18 public: | 19 public: |
19 TestWindowDelegate(); | 20 TestWindowDelegate(); |
20 virtual ~TestWindowDelegate(); | 21 virtual ~TestWindowDelegate(); |
21 | 22 |
(...skipping 13 matching lines...) Expand all Loading... |
35 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; | 36 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; |
36 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; | 37 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; |
37 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; | 38 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; |
38 virtual bool CanFocus() OVERRIDE; | 39 virtual bool CanFocus() OVERRIDE; |
39 virtual void OnCaptureLost() OVERRIDE; | 40 virtual void OnCaptureLost() OVERRIDE; |
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 41 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
41 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 42 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
42 virtual void OnWindowDestroying() OVERRIDE; | 43 virtual void OnWindowDestroying() OVERRIDE; |
43 virtual void OnWindowDestroyed() OVERRIDE; | 44 virtual void OnWindowDestroyed() OVERRIDE; |
44 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 45 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
| 46 virtual bool HasHitTestMask() const OVERRIDE; |
| 47 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
45 | 48 |
46 private: | 49 private: |
47 int window_component_; | 50 int window_component_; |
48 | 51 |
49 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 52 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
50 }; | 53 }; |
51 | 54 |
52 // A simple WindowDelegate implementation for these tests. It owns itself | 55 // A simple WindowDelegate implementation for these tests. It owns itself |
53 // (deletes itself when the Window it is attached to is destroyed). | 56 // (deletes itself when the Window it is attached to is destroyed). |
54 class ColorTestWindowDelegate : public TestWindowDelegate { | 57 class ColorTestWindowDelegate : public TestWindowDelegate { |
55 public: | 58 public: |
56 explicit ColorTestWindowDelegate(SkColor color); | 59 explicit ColorTestWindowDelegate(SkColor color); |
57 virtual ~ColorTestWindowDelegate(); | 60 virtual ~ColorTestWindowDelegate(); |
58 | 61 |
59 ui::KeyboardCode last_key_code() const { return last_key_code_; } | 62 ui::KeyboardCode last_key_code() const { return last_key_code_; } |
60 | 63 |
61 // Overridden from TestWindowDelegate: | 64 // Overridden from TestWindowDelegate: |
62 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 65 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; |
63 virtual void OnWindowDestroyed() OVERRIDE; | 66 virtual void OnWindowDestroyed() OVERRIDE; |
64 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 67 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
65 | 68 |
66 private: | 69 private: |
67 SkColor color_; | 70 SkColor color_; |
68 ui::KeyboardCode last_key_code_; | 71 ui::KeyboardCode last_key_code_; |
69 | 72 |
70 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); |
71 }; | 74 }; |
72 | 75 |
| 76 // A simple WindowDelegate that has a hit-test mask. |
| 77 class MaskedWindowDelegate : public TestWindowDelegate { |
| 78 public: |
| 79 explicit MaskedWindowDelegate(const gfx::Rect mask_rect); |
| 80 |
| 81 // Overridden from TestWindowDelegate: |
| 82 virtual bool HasHitTestMask() const OVERRIDE; |
| 83 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
| 84 |
| 85 private: |
| 86 gfx::Rect mask_rect_; |
| 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); |
| 89 }; |
| 90 |
73 } // namespace test | 91 } // namespace test |
74 } // namespace aura | 92 } // namespace aura |
75 | 93 |
76 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 94 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
OLD | NEW |