OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // window coordinates. | 48 // window coordinates. |
49 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; | 49 virtual int GetNonClientComponent(const gfx::Point& point) const = 0; |
50 | 50 |
51 virtual bool OnMouseEvent(MouseEvent* event) = 0; | 51 virtual bool OnMouseEvent(MouseEvent* event) = 0; |
52 | 52 |
53 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; | 53 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) = 0; |
54 | 54 |
55 // Returns true of the window can be focused. | 55 // Returns true of the window can be focused. |
56 virtual bool CanFocus() = 0; | 56 virtual bool CanFocus() = 0; |
57 | 57 |
| 58 // Returns true if the window should be activated. |event| is either the mouse |
| 59 // event supplied if the activation is the result of a mouse, or the touch |
| 60 // event if the activation is the result of a touch, or NULL if activation is |
| 61 // attempted for another reason. |
| 62 virtual bool ShouldActivate(Event* event) = 0; |
| 63 |
| 64 // Sent when the window is activated. |
| 65 virtual void OnActivated() = 0; |
| 66 |
| 67 // Sent when the window loses active status. |
| 68 virtual void OnLostActive() = 0; |
| 69 |
58 // Invoked when mouse capture is lost on the window. | 70 // Invoked when mouse capture is lost on the window. |
59 virtual void OnCaptureLost() = 0; | 71 virtual void OnCaptureLost() = 0; |
60 | 72 |
61 // Asks the delegate to paint window contents into the supplied canvas. | 73 // Asks the delegate to paint window contents into the supplied canvas. |
62 virtual void OnPaint(gfx::Canvas* canvas) = 0; | 74 virtual void OnPaint(gfx::Canvas* canvas) = 0; |
63 | 75 |
64 // Called from Window's destructor before OnWindowDestroyed and before the | 76 // Called from Window's destructor before OnWindowDestroyed and before the |
65 // children have been destroyed. | 77 // children have been destroyed. |
66 virtual void OnWindowDestroying() = 0; | 78 virtual void OnWindowDestroying() = 0; |
67 | 79 |
68 // Called when the Window has been destroyed (i.e. from its destructor). This | 80 // Called when the Window has been destroyed (i.e. from its destructor). This |
69 // is called after OnWindowDestroying and after the children have been | 81 // is called after OnWindowDestroying and after the children have been |
70 // deleted. | 82 // deleted. |
71 // The delegate can use this as an opportunity to delete itself if necessary. | 83 // The delegate can use this as an opportunity to delete itself if necessary. |
72 virtual void OnWindowDestroyed() = 0; | 84 virtual void OnWindowDestroyed() = 0; |
73 | 85 |
74 // Called when the visibility of a Window changed. | 86 // Called when the visibility of a Window changed. |
75 virtual void OnWindowVisibilityChanged(bool visible) = 0; | 87 virtual void OnWindowVisibilityChanged(bool visible) = 0; |
76 | 88 |
77 protected: | 89 protected: |
78 virtual ~WindowDelegate() {} | 90 virtual ~WindowDelegate() {} |
79 }; | 91 }; |
80 | 92 |
81 } // namespace aura | 93 } // namespace aura |
82 | 94 |
83 #endif // UI_AURA_WINDOW_DELEGATE_H_ | 95 #endif // UI_AURA_WINDOW_DELEGATE_H_ |
OLD | NEW |