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_CLIENT_ACTIVATION_DELEGATE_H_ | 5 #ifndef UI_AURA_CLIENT_ACTIVATION_DELEGATE_H_ |
6 #define UI_AURA_CLIENT_ACTIVATION_DELEGATE_H_ | 6 #define UI_AURA_CLIENT_ACTIVATION_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 | 10 |
11 namespace aura { | 11 namespace aura { |
12 class Event; | 12 class Event; |
13 class Window; | 13 class Window; |
14 namespace client { | 14 namespace client { |
15 | 15 |
| 16 // A property key to store the activation delegate for a window. The type of the |
| 17 // value is |aura::ActivationDelegate*|. |
| 18 AURA_EXPORT extern const char kActivationDelegateKey[]; |
| 19 |
16 // An interface implemented by an object that configures and responds to changes | 20 // An interface implemented by an object that configures and responds to changes |
17 // to a window's activation state. | 21 // to a window's activation state. |
18 class AURA_EXPORT ActivationDelegate { | 22 class AURA_EXPORT ActivationDelegate { |
19 public: | 23 public: |
20 // Returns true if the window should be activated. |event| is either the mouse | 24 // Returns true if the window should be activated. |event| is either the mouse |
21 // event supplied if the activation is the result of a mouse, or the touch | 25 // event supplied if the activation is the result of a mouse, or the touch |
22 // event if the activation is the result of a touch, or NULL if activation is | 26 // event if the activation is the result of a touch, or NULL if activation is |
23 // attempted for another reason. | 27 // attempted for another reason. |
24 virtual bool ShouldActivate(Event* event) = 0; | 28 virtual bool ShouldActivate(Event* event) = 0; |
25 | 29 |
26 // Sent when the window is activated. | 30 // Sent when the window is activated. |
27 virtual void OnActivated() = 0; | 31 virtual void OnActivated() = 0; |
28 | 32 |
29 // Sent when the window loses active status. | 33 // Sent when the window loses active status. |
30 virtual void OnLostActive() = 0; | 34 virtual void OnLostActive() = 0; |
31 | 35 |
32 protected: | 36 protected: |
33 virtual ~ActivationDelegate() {} | 37 virtual ~ActivationDelegate() {} |
34 }; | 38 }; |
35 | 39 |
36 // Sets/Gets the ActivationDelegate on the Window. No ownership changes. | 40 // Sets/Gets the ActivationDelegate on the Window. No ownership changes. |
37 AURA_EXPORT void SetActivationDelegate(Window* window, | 41 AURA_EXPORT void SetActivationDelegate(Window* window, |
38 ActivationDelegate* delegate); | 42 ActivationDelegate* delegate); |
39 AURA_EXPORT ActivationDelegate* GetActivationDelegate(Window* window); | 43 AURA_EXPORT ActivationDelegate* GetActivationDelegate(Window* window); |
40 | 44 |
41 } // namespace client | 45 } // namespace client |
42 } // namespace aura | 46 } // namespace aura |
43 | 47 |
44 #endif // UI_AURA_CLIENT_ACTIVATION_DELEGATE_H_ | 48 #endif // UI_AURA_CLIENT_ACTIVATION_DELEGATE_H_ |
OLD | NEW |