Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Side by Side Diff: chrome/browser/ui/gtk/slide_animator_gtk.h

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // A helper class for animating the display of native widget content. 5 // A helper class for animating the display of native widget content.
6 // Currently only handle vertical sliding, but could be extended to handle 6 // Currently only handle vertical sliding, but could be extended to handle
7 // horizontal slides or other types of animations. 7 // horizontal slides or other types of animations.
8 // 8 //
9 // NOTE: This does not handle clipping. If you are not careful, you will 9 // NOTE: This does not handle clipping. If you are not careful, you will
10 // wind up with visibly overlapping widgets. If you need clipping, you can 10 // wind up with visibly overlapping widgets. If you need clipping, you can
11 // extend the constructor to take an option to give |fixed| its own GdkWindow 11 // extend the constructor to take an option to give |fixed| its own GdkWindow
12 // (via gtk_fixed_set_has_window). 12 // (via gtk_fixed_set_has_window).
13 13
14 #ifndef CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_ 14 #ifndef CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
15 #define CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_ 15 #define CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
16 16
17 #include <gtk/gtk.h> 17 #include <gtk/gtk.h>
18 18
19 #include "base/compiler_specific.h" 19 #include "base/compiler_specific.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "ui/base/animation/animation_delegate.h"
22 #include "ui/base/gtk/owned_widget_gtk.h" 21 #include "ui/base/gtk/owned_widget_gtk.h"
22 #include "ui/gfx/animation/animation_delegate.h"
23 23
24 namespace ui { 24 namespace gfx {
25 class SlideAnimation; 25 class SlideAnimation;
26 } 26 }
27 27
28 class SlideAnimatorGtk : public ui::AnimationDelegate { 28 class SlideAnimatorGtk : public gfx::AnimationDelegate {
29 public: 29 public:
30 class Delegate { 30 class Delegate {
31 public: 31 public:
32 // Called when a call to Close() finishes animating. 32 // Called when a call to Close() finishes animating.
33 virtual void Closed() = 0; 33 virtual void Closed() = 0;
34 34
35 protected: 35 protected:
36 virtual ~Delegate() {} 36 virtual ~Delegate() {}
37 }; 37 };
38 38
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Returns whether the widget is visible. 77 // Returns whether the widget is visible.
78 bool IsShowing(); 78 bool IsShowing();
79 79
80 // Returns whether the widget is currently showing the close animation. 80 // Returns whether the widget is currently showing the close animation.
81 bool IsClosing(); 81 bool IsClosing();
82 82
83 // Returns whether the widget is currently showing the open or close 83 // Returns whether the widget is currently showing the open or close
84 // animation. 84 // animation.
85 bool IsAnimating(); 85 bool IsAnimating();
86 86
87 // ui::AnimationDelegate implementation. 87 // gfx::AnimationDelegate implementation.
88 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 88 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
89 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 89 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE;
90 90
91 // Used during testing; disable or enable animations (default is enabled). 91 // Used during testing; disable or enable animations (default is enabled).
92 static void SetAnimationsForTesting(bool enable); 92 static void SetAnimationsForTesting(bool enable);
93 93
94 private: 94 private:
95 static void OnChildSizeAllocate(GtkWidget* child, 95 static void OnChildSizeAllocate(GtkWidget* child,
96 GtkAllocation* allocation, 96 GtkAllocation* allocation,
97 SlideAnimatorGtk* slider); 97 SlideAnimatorGtk* slider);
98 98
99 scoped_ptr<ui::SlideAnimation> animation_; 99 scoped_ptr<gfx::SlideAnimation> animation_;
100 100
101 // The top level widget of the SlideAnimatorGtk. It is a GtkFixed. 101 // The top level widget of the SlideAnimatorGtk. It is a GtkFixed.
102 ui::OwnedWidgetGtk widget_; 102 ui::OwnedWidgetGtk widget_;
103 103
104 // The widget passed to us at construction time, and the only direct child of 104 // The widget passed to us at construction time, and the only direct child of
105 // |widget_|. 105 // |widget_|.
106 GtkWidget* child_; 106 GtkWidget* child_;
107 107
108 // The direction of the slide. 108 // The direction of the slide.
109 Direction direction_; 109 Direction direction_;
110 110
111 // The object to inform about certain events. It may be NULL. 111 // The object to inform about certain events. It may be NULL.
112 Delegate* delegate_; 112 Delegate* delegate_;
113 113
114 // We need to move the child widget to (0, -height), but we don't know its 114 // We need to move the child widget to (0, -height), but we don't know its
115 // height until it has been allocated. This variable will be true until the 115 // height until it has been allocated. This variable will be true until the
116 // child widget has been allocated, at which point we will move it, and then 116 // child widget has been allocated, at which point we will move it, and then
117 // set this variable to false to indicate it should not be moved again. 117 // set this variable to false to indicate it should not be moved again.
118 bool child_needs_move_; 118 bool child_needs_move_;
119 119
120 static bool animations_enabled_; 120 static bool animations_enabled_;
121 }; 121 };
122 122
123 #endif // CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_ 123 #endif // CHROME_BROWSER_UI_GTK_SLIDE_ANIMATOR_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc ('k') | chrome/browser/ui/gtk/slide_animator_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698