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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_
6 #define UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_
10 #include "ui/views/views_export.h"
22 class ImplicitAnimationObserver;
24 class LayerAnimationSequence;
30 // A variety of canned animations for window transitions.
31 enum WindowVisibilityAnimationType {
32 WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT = 0, // Default. Lets the system
33 // decide based on window
35 WINDOW_VISIBILITY_ANIMATION_TYPE_DROP, // Window shrinks in.
36 WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL, // Vertical Glenimation.
37 WINDOW_VISIBILITY_ANIMATION_TYPE_FADE, // Fades in/out.
38 WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE, // Window rotates in.
40 // Downstream library animations start above this point.
41 WINDOW_VISIBILITY_ANIMATION_MAX
44 // Canned animations that take effect once but don't have a symmetric pair as
45 // visibility animations do.
46 enum WindowAnimationType {
47 WINDOW_ANIMATION_TYPE_BOUNCE = 0, // Window scales up and down.
50 // Type of visibility change transition that a window should animate.
51 // Default behavior is to animate both show and hide.
52 enum WindowVisibilityAnimationTransition {
55 ANIMATE_BOTH = ANIMATE_SHOW | ANIMATE_HIDE,
59 // These two methods use int for type rather than WindowVisibilityAnimationType
60 // since downstream libraries can extend the set of animations.
61 VIEWS_EXPORT void SetWindowVisibilityAnimationType(aura::Window* window,
63 VIEWS_EXPORT int GetWindowVisibilityAnimationType(aura::Window* window);
65 VIEWS_EXPORT void SetWindowVisibilityAnimationTransition(
67 WindowVisibilityAnimationTransition transition);
69 VIEWS_EXPORT bool HasWindowVisibilityAnimationTransition(
71 WindowVisibilityAnimationTransition transition);
73 VIEWS_EXPORT void SetWindowVisibilityAnimationDuration(
75 const base::TimeDelta& duration);
77 VIEWS_EXPORT void SetWindowVisibilityAnimationVerticalPosition(
81 // Creates an ImplicitAnimationObserver that takes ownership of the layers
82 // associated with a Window so that the animation can continue after the Window
83 // has been destroyed.
84 // The returned object deletes itself when the animations are done.
85 VIEWS_EXPORT ui::ImplicitAnimationObserver* CreateHidingWindowAnimationObserver(
86 aura::Window* window);
88 // Returns false if the |window| didn't animate.
89 VIEWS_EXPORT bool AnimateOnChildWindowVisibilityChanged(aura::Window* window,
91 VIEWS_EXPORT bool AnimateWindow(aura::Window* window, WindowAnimationType type);
93 // Returns true if window animations are disabled for |window|. Window
94 // animations are enabled by default. If |window| is NULL, this just checks
95 // if the global flag disabling window animations is present.
96 VIEWS_EXPORT bool WindowAnimationsDisabled(aura::Window* window);
101 #endif // UI_VIEWS_COREWM_WINDOW_ANIMATIONS_H_