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_WINDOW_DELEGATE_H_ | 5 #ifndef UI_AURA_WINDOW_DELEGATE_H_ |
6 #define UI_AURA_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_WINDOW_DELEGATE_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 #include "ui/base/events.h" | 9 #include "ui/base/events.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 | 11 |
12 namespace gfx { | 12 namespace gfx { |
13 class Canvas; | 13 class Canvas; |
14 class Path; | 14 class Path; |
15 class Point; | 15 class Point; |
16 class Rect; | 16 class Rect; |
17 class Size; | 17 class Size; |
18 } | 18 } |
19 | 19 |
| 20 namespace ui { |
| 21 class GestureEventImpl; |
| 22 class KeyEvent; |
| 23 class MouseEvent; |
| 24 class TouchEventImpl; |
| 25 } |
| 26 |
20 namespace aura { | 27 namespace aura { |
21 | 28 |
22 class Event; | |
23 class GestureEvent; | |
24 class KeyEvent; | |
25 class MouseEvent; | |
26 class TouchEvent; | |
27 | |
28 // Delegate interface for aura::Window. | 29 // Delegate interface for aura::Window. |
29 class AURA_EXPORT WindowDelegate { | 30 class AURA_EXPORT WindowDelegate { |
30 public: | 31 public: |
31 // Returns the window's minimum size, or size 0,0 if there is no limit. | 32 // Returns the window's minimum size, or size 0,0 if there is no limit. |
32 virtual gfx::Size GetMinimumSize() const = 0; | 33 virtual gfx::Size GetMinimumSize() const = 0; |
33 | 34 |
34 // Called when the Window's position and/or size changes. | 35 // Called when the Window's position and/or size changes. |
35 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 36 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
36 const gfx::Rect& new_bounds) = 0; | 37 const gfx::Rect& new_bounds) = 0; |
37 | 38 |
38 // Sent to the Window's delegate when the Window gains or loses focus. | 39 // Sent to the Window's delegate when the Window gains or loses focus. |
39 virtual void OnFocus(aura::Window* old_focused_window) = 0; | 40 virtual void OnFocus(aura::Window* old_focused_window) = 0; |
40 virtual void OnBlur() = 0; | 41 virtual void OnBlur() = 0; |
41 | 42 |
42 virtual bool OnKeyEvent(KeyEvent* event) = 0; | 43 virtual bool OnKeyEvent(ui::KeyEvent* event) = 0; |
43 | 44 |
44 // Returns the native cursor for the specified point, in window coordinates, | 45 // Returns the native cursor for the specified point, in window coordinates, |
45 // or NULL for the default cursor. | 46 // or NULL for the default cursor. |
46 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; | 47 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; |
47 | 48 |
48 // Returns the non-client component (see hit_test.h) containing |point|, in | 49 // Returns the non-client component (see hit_test.h) containing |point|, in |
49 // window coordinates. | 50 // window coordinates. |
50 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | 51 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; |
51 | 52 |
52 // Returns true if event handling should descend into |child|. |location| is | 53 // Returns true if event handling should descend into |child|. |location| is |
53 // in terms of the Window. | 54 // in terms of the Window. |
54 virtual bool ShouldDescendIntoChildForEventHandling( | 55 virtual bool ShouldDescendIntoChildForEventHandling( |
55 Window* child, | 56 Window* child, |
56 const gfx::Point& location) = 0; | 57 const gfx::Point& location) = 0; |
57 | 58 |
58 virtual bool OnMouseEvent(MouseEvent* event) = 0; | 59 virtual bool OnMouseEvent(ui::MouseEvent* event) = 0; |
59 | 60 |
60 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; | 61 virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) = 0; |
61 | 62 |
62 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) = 0; | 63 virtual ui::GestureStatus OnGestureEvent(ui::GestureEventImpl* event) = 0; |
63 | 64 |
64 // Returns true of the window can be focused. | 65 // Returns true of the window can be focused. |
65 virtual bool CanFocus() = 0; | 66 virtual bool CanFocus() = 0; |
66 | 67 |
67 // Invoked when mouse capture is lost on the window. | 68 // Invoked when mouse capture is lost on the window. |
68 virtual void OnCaptureLost() = 0; | 69 virtual void OnCaptureLost() = 0; |
69 | 70 |
70 // Asks the delegate to paint window contents into the supplied canvas. | 71 // Asks the delegate to paint window contents into the supplied canvas. |
71 virtual void OnPaint(gfx::Canvas* canvas) = 0; | 72 virtual void OnPaint(gfx::Canvas* canvas) = 0; |
72 | 73 |
(...skipping 26 matching lines...) Expand all Loading... |
99 // above returns true. | 100 // above returns true. |
100 virtual void GetHitTestMask(gfx::Path* mask) const = 0; | 101 virtual void GetHitTestMask(gfx::Path* mask) const = 0; |
101 | 102 |
102 protected: | 103 protected: |
103 virtual ~WindowDelegate() {} | 104 virtual ~WindowDelegate() {} |
104 }; | 105 }; |
105 | 106 |
106 } // namespace aura | 107 } // namespace aura |
107 | 108 |
108 #endif // UI_AURA_WINDOW_DELEGATE_H_ | 109 #endif // UI_AURA_WINDOW_DELEGATE_H_ |
OLD | NEW |