OLD | NEW |
1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/aura/aura_export.h" | 9 #include "ui/aura/aura_export.h" |
10 #include "ui/base/events.h" | 10 #include "ui/base/events.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Canvas; | 14 class Canvas; |
15 class Point; | 15 class Point; |
16 class Rect; | 16 class Rect; |
17 class Size; | 17 class Size; |
18 } | 18 } |
19 | 19 |
20 namespace aura { | 20 namespace aura { |
21 | 21 |
22 class Event; | 22 class Event; |
| 23 class GestureEvent; |
23 class KeyEvent; | 24 class KeyEvent; |
24 class MouseEvent; | 25 class MouseEvent; |
25 class TouchEvent; | 26 class TouchEvent; |
26 | 27 |
27 // Delegate interface for aura::Window. | 28 // Delegate interface for aura::Window. |
28 class AURA_EXPORT WindowDelegate { | 29 class AURA_EXPORT WindowDelegate { |
29 public: | 30 public: |
30 // Returns the window's minimum size, or size 0,0 if there is no limit. | 31 // Returns the window's minimum size, or size 0,0 if there is no limit. |
31 virtual gfx::Size GetMinimumSize() const = 0; | 32 virtual gfx::Size GetMinimumSize() const = 0; |
32 | 33 |
(...skipping 12 matching lines...) Expand all Loading... |
45 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; | 46 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) = 0; |
46 | 47 |
47 // Returns the non-client component (see hit_test.h) containing |point|, in | 48 // Returns the non-client component (see hit_test.h) containing |point|, in |
48 // window coordinates. | 49 // window coordinates. |
49 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | 50 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; |
50 | 51 |
51 virtual bool OnMouseEvent(MouseEvent* event) = 0; | 52 virtual bool OnMouseEvent(MouseEvent* event) = 0; |
52 | 53 |
53 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; | 54 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; |
54 | 55 |
| 56 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) = 0; |
| 57 |
55 // Returns true of the window can be focused. | 58 // Returns true of the window can be focused. |
56 virtual bool CanFocus() = 0; | 59 virtual bool CanFocus() = 0; |
57 | 60 |
58 // Invoked when mouse capture is lost on the window. | 61 // Invoked when mouse capture is lost on the window. |
59 virtual void OnCaptureLost() = 0; | 62 virtual void OnCaptureLost() = 0; |
60 | 63 |
61 // Asks the delegate to paint window contents into the supplied canvas. | 64 // Asks the delegate to paint window contents into the supplied canvas. |
62 virtual void OnPaint(gfx::Canvas* canvas) = 0; | 65 virtual void OnPaint(gfx::Canvas* canvas) = 0; |
63 | 66 |
64 // Called from Window's destructor before OnWindowDestroyed and before the | 67 // Called from Window's destructor before OnWindowDestroyed and before the |
65 // children have been destroyed. | 68 // children have been destroyed. |
66 virtual void OnWindowDestroying() = 0; | 69 virtual void OnWindowDestroying() = 0; |
67 | 70 |
68 // Called when the Window has been destroyed (i.e. from its destructor). This | 71 // Called when the Window has been destroyed (i.e. from its destructor). This |
69 // is called after OnWindowDestroying and after the children have been | 72 // is called after OnWindowDestroying and after the children have been |
70 // deleted. | 73 // deleted. |
71 // The delegate can use this as an opportunity to delete itself if necessary. | 74 // The delegate can use this as an opportunity to delete itself if necessary. |
72 virtual void OnWindowDestroyed() = 0; | 75 virtual void OnWindowDestroyed() = 0; |
73 | 76 |
74 // Called when the visibility of a Window changed. | 77 // Called when the visibility of a Window changed. |
75 virtual void OnWindowVisibilityChanged(bool visible) = 0; | 78 virtual void OnWindowVisibilityChanged(bool visible) = 0; |
76 | 79 |
77 protected: | 80 protected: |
78 virtual ~WindowDelegate() {} | 81 virtual ~WindowDelegate() {} |
79 }; | 82 }; |
80 | 83 |
81 } // namespace aura | 84 } // namespace aura |
82 | 85 |
83 #endif // UI_AURA_WINDOW_DELEGATE_H_ | 86 #endif // UI_AURA_WINDOW_DELEGATE_H_ |
OLD | NEW |