OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/gtk/slide_animator_gtk.h" | 5 #include "chrome/browser/gtk/slide_animator_gtk.h" |
6 | 6 |
7 #include "app/animation.h" | 7 #include "app/animation.h" |
8 #include "app/slide_animation.h" | 8 #include "app/slide_animation.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 | 10 |
11 #include "chrome/browser/gtk/gtk_expanded_container.h" | 11 #include "chrome/browser/gtk/gtk_expanded_container.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // position here is that the widget is currently unallocated and may not | 53 // position here is that the widget is currently unallocated and may not |
54 // even have a size request. | 54 // even have a size request. |
55 g_signal_connect(child, "size-allocate", | 55 g_signal_connect(child, "size-allocate", |
56 G_CALLBACK(OnChildSizeAllocate), this); | 56 G_CALLBACK(OnChildSizeAllocate), this); |
57 | 57 |
58 child_needs_move_ = (direction == DOWN); | 58 child_needs_move_ = (direction == DOWN); |
59 | 59 |
60 animation_.reset(new SlideAnimation(this)); | 60 animation_.reset(new SlideAnimation(this)); |
61 // Default tween type is EASE_OUT. | 61 // Default tween type is EASE_OUT. |
62 if (linear) | 62 if (linear) |
63 animation_->SetTweenType(SlideAnimation::NONE); | 63 animation_->SetTweenType(Tween::LINEAR); |
64 if (duration != 0) | 64 if (duration != 0) |
65 animation_->SetSlideDuration(duration); | 65 animation_->SetSlideDuration(duration); |
66 } | 66 } |
67 | 67 |
68 SlideAnimatorGtk::~SlideAnimatorGtk() { | 68 SlideAnimatorGtk::~SlideAnimatorGtk() { |
69 widget_.Destroy(); | 69 widget_.Destroy(); |
70 } | 70 } |
71 | 71 |
72 void SlideAnimatorGtk::Open() { | 72 void SlideAnimatorGtk::Open() { |
73 if (!animations_enabled_) | 73 if (!animations_enabled_) |
(...skipping 30 matching lines...) Expand all Loading... |
104 | 104 |
105 bool SlideAnimatorGtk::IsShowing() { | 105 bool SlideAnimatorGtk::IsShowing() { |
106 return animation_->IsShowing(); | 106 return animation_->IsShowing(); |
107 } | 107 } |
108 | 108 |
109 bool SlideAnimatorGtk::IsClosing() { | 109 bool SlideAnimatorGtk::IsClosing() { |
110 return animation_->IsClosing(); | 110 return animation_->IsClosing(); |
111 } | 111 } |
112 | 112 |
113 bool SlideAnimatorGtk::IsAnimating() { | 113 bool SlideAnimatorGtk::IsAnimating() { |
114 return animation_->IsAnimating(); | 114 return animation_->is_animating(); |
115 } | 115 } |
116 | 116 |
117 void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) { | 117 void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) { |
118 GtkRequisition req; | 118 GtkRequisition req; |
119 gtk_widget_size_request(child_, &req); | 119 gtk_widget_size_request(child_, &req); |
120 | 120 |
121 int showing_height = static_cast<int>(req.height * | 121 int showing_height = static_cast<int>(req.height * |
122 animation_->GetCurrentValue()); | 122 animation_->GetCurrentValue()); |
123 if (direction_ == DOWN) { | 123 if (direction_ == DOWN) { |
124 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()), | 124 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()), |
(...skipping 19 matching lines...) Expand all Loading... |
144 // static | 144 // static |
145 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, | 145 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, |
146 GtkAllocation* allocation, | 146 GtkAllocation* allocation, |
147 SlideAnimatorGtk* slider) { | 147 SlideAnimatorGtk* slider) { |
148 if (slider->child_needs_move_) { | 148 if (slider->child_needs_move_) { |
149 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(slider->widget()), | 149 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(slider->widget()), |
150 child, 0, -allocation->height); | 150 child, 0, -allocation->height); |
151 slider->child_needs_move_ = false; | 151 slider->child_needs_move_ = false; |
152 } | 152 } |
153 } | 153 } |
OLD | NEW |