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_WM_CORE_WINDOW_ANIMATIONS_H_ | 5 #ifndef UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
6 #define UI_WM_CORE_WINDOW_ANIMATIONS_H_ | 6 #define UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ui/compositor/scoped_layer_animation_settings.h" | 10 #include "ui/compositor/scoped_layer_animation_settings.h" |
11 #include "ui/wm/core/wm_core_export.h" | 11 #include "ui/wm/wm_export.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class Window; | 14 class Window; |
15 } | 15 } |
16 namespace base { | 16 namespace base { |
17 class TimeDelta; | 17 class TimeDelta; |
18 } | 18 } |
19 namespace gfx { | 19 namespace gfx { |
20 class Rect; | 20 class Rect; |
21 } | 21 } |
(...skipping 29 matching lines...) Expand all Loading... |
51 // Default behavior is to animate both show and hide. | 51 // Default behavior is to animate both show and hide. |
52 enum WindowVisibilityAnimationTransition { | 52 enum WindowVisibilityAnimationTransition { |
53 ANIMATE_SHOW = 0x1, | 53 ANIMATE_SHOW = 0x1, |
54 ANIMATE_HIDE = 0x2, | 54 ANIMATE_HIDE = 0x2, |
55 ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE, | 55 ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE, |
56 ANIMATE_NONE = 0x4, | 56 ANIMATE_NONE = 0x4, |
57 }; | 57 }; |
58 | 58 |
59 // These two methods use int for type rather than WindowVisibilityAnimationType | 59 // These two methods use int for type rather than WindowVisibilityAnimationType |
60 // since downstream libraries can extend the set of animations. | 60 // since downstream libraries can extend the set of animations. |
61 WM_CORE_EXPORT void SetWindowVisibilityAnimationType(aura::Window* window, | 61 WM_EXPORT void SetWindowVisibilityAnimationType(aura::Window* window, |
62 int type); | 62 int type); |
63 WM_CORE_EXPORT int GetWindowVisibilityAnimationType(aura::Window* window); | 63 WM_EXPORT int GetWindowVisibilityAnimationType(aura::Window* window); |
64 | 64 |
65 WM_CORE_EXPORT void SetWindowVisibilityAnimationTransition( | 65 WM_EXPORT void SetWindowVisibilityAnimationTransition( |
66 aura::Window* window, | 66 aura::Window* window, |
67 WindowVisibilityAnimationTransition transition); | 67 WindowVisibilityAnimationTransition transition); |
68 | 68 |
69 WM_CORE_EXPORT bool HasWindowVisibilityAnimationTransition( | 69 WM_EXPORT bool HasWindowVisibilityAnimationTransition( |
70 aura::Window* window, | 70 aura::Window* window, |
71 WindowVisibilityAnimationTransition transition); | 71 WindowVisibilityAnimationTransition transition); |
72 | 72 |
73 WM_CORE_EXPORT void SetWindowVisibilityAnimationDuration( | 73 WM_EXPORT void SetWindowVisibilityAnimationDuration( |
74 aura::Window* window, | 74 aura::Window* window, |
75 const base::TimeDelta& duration); | 75 const base::TimeDelta& duration); |
76 | 76 |
77 WM_CORE_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( | 77 WM_EXPORT base::TimeDelta GetWindowVisibilityAnimationDuration( |
78 const aura::Window& window); | 78 const aura::Window& window); |
79 | 79 |
80 WM_CORE_EXPORT void SetWindowVisibilityAnimationVerticalPosition( | 80 WM_EXPORT void SetWindowVisibilityAnimationVerticalPosition( |
81 aura::Window* window, | 81 aura::Window* window, |
82 float position); | 82 float position); |
83 | 83 |
84 class HidingWindowAnimationObserver; | 84 class HidingWindowAnimationObserver; |
85 // A wrapper of ui::ScopedLayerAnimationSettings for hiding animations. | 85 // A wrapper of ui::ScopedLayerAnimationSettings for hiding animations. |
86 // Use this to ensure that the hiding animation is visible even after | 86 // Use this to ensure that the hiding animation is visible even after |
87 // the window is deleted or deactivated, instead of using | 87 // the window is deleted or deactivated, instead of using |
88 // ui::ScopedLayerAnimationSettings directly. | 88 // ui::ScopedLayerAnimationSettings directly. |
89 class WM_CORE_EXPORT ScopedHidingAnimationSettings { | 89 class WM_EXPORT ScopedHidingAnimationSettings { |
90 public: | 90 public: |
91 explicit ScopedHidingAnimationSettings(aura::Window* window); | 91 explicit ScopedHidingAnimationSettings(aura::Window* window); |
92 ~ScopedHidingAnimationSettings(); | 92 ~ScopedHidingAnimationSettings(); |
93 | 93 |
94 // Returns the wrapped ScopedLayeAnimationSettings instance. | 94 // Returns the wrapped ScopedLayeAnimationSettings instance. |
95 ui::ScopedLayerAnimationSettings* layer_animation_settings() { | 95 ui::ScopedLayerAnimationSettings* layer_animation_settings() { |
96 return &layer_animation_settings_; | 96 return &layer_animation_settings_; |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 ui::ScopedLayerAnimationSettings layer_animation_settings_; | 100 ui::ScopedLayerAnimationSettings layer_animation_settings_; |
101 HidingWindowAnimationObserver* observer_; | 101 HidingWindowAnimationObserver* observer_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(ScopedHidingAnimationSettings); | 103 DISALLOW_COPY_AND_ASSIGN(ScopedHidingAnimationSettings); |
104 }; | 104 }; |
105 | 105 |
106 // Returns false if the |window| didn't animate. | 106 // Returns false if the |window| didn't animate. |
107 WM_CORE_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, | 107 WM_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, |
108 bool visible); | 108 bool visible); |
109 WM_CORE_EXPORT bool AnimateWindow(aura::Window* window, | 109 WM_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type); |
110 WindowAnimationType type); | |
111 | 110 |
112 // Returns true if window animations are disabled for |window|. Window | 111 // Returns true if window animations are disabled for |window|. Window |
113 // animations are enabled by default. If |window| is NULL, this just checks | 112 // animations are enabled by default. If |window| is NULL, this just checks |
114 // if the global flag disabling window animations is present. | 113 // if the global flag disabling window animations is present. |
115 WM_CORE_EXPORT bool WindowAnimationsDisabled(aura::Window* window); | 114 WM_EXPORT bool WindowAnimationsDisabled(aura::Window* window); |
116 | 115 |
117 } // namespace wm | 116 } // namespace wm |
118 | 117 |
119 #endif // UI_WM_CORE_WINDOW_ANIMATIONS_H_ | 118 #endif // UI_WM_CORE_WINDOW_ANIMATIONS_H_ |
OLD | NEW |