OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 bool SlideAnimatorGtk::IsClosing() { | 105 bool SlideAnimatorGtk::IsClosing() { |
106 return animation_->IsClosing(); | 106 return animation_->IsClosing(); |
107 } | 107 } |
108 | 108 |
109 bool SlideAnimatorGtk::IsAnimating() { | 109 bool SlideAnimatorGtk::IsAnimating() { |
110 return animation_->IsAnimating(); | 110 return animation_->IsAnimating(); |
111 } | 111 } |
112 | 112 |
113 void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) { | 113 void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) { |
114 int showing_height = child_->allocation.height * | 114 int showing_height = static_cast<int>(child_->allocation.height * |
115 animation_->GetCurrentValue(); | 115 animation_->GetCurrentValue()); |
116 if (direction_ == DOWN) { | 116 if (direction_ == DOWN) { |
117 gtk_fixed_move(GTK_FIXED(widget_.get()), child_, 0, | 117 gtk_fixed_move(GTK_FIXED(widget_.get()), child_, 0, |
118 showing_height - child_->allocation.height); | 118 showing_height - child_->allocation.height); |
119 } | 119 } |
120 gtk_widget_set_size_request(widget_.get(), -1, showing_height); | 120 gtk_widget_set_size_request(widget_.get(), -1, showing_height); |
121 } | 121 } |
122 | 122 |
123 void SlideAnimatorGtk::AnimationEnded(const Animation* animation) { | 123 void SlideAnimatorGtk::AnimationEnded(const Animation* animation) { |
124 if (!animation_->IsShowing()) { | 124 if (!animation_->IsShowing()) { |
125 gtk_widget_hide(widget_.get()); | 125 gtk_widget_hide(widget_.get()); |
126 if (delegate_) | 126 if (delegate_) |
127 delegate_->Closed(); | 127 delegate_->Closed(); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 // static | 131 // static |
132 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, | 132 void SlideAnimatorGtk::OnChildSizeAllocate(GtkWidget* child, |
133 GtkAllocation* allocation, | 133 GtkAllocation* allocation, |
134 SlideAnimatorGtk* slider) { | 134 SlideAnimatorGtk* slider) { |
135 if (slider->child_needs_move_) { | 135 if (slider->child_needs_move_) { |
136 gtk_fixed_move(GTK_FIXED(slider->widget()), child, 0, -allocation->height); | 136 gtk_fixed_move(GTK_FIXED(slider->widget()), child, 0, -allocation->height); |
137 slider->child_needs_move_ = false; | 137 slider->child_needs_move_ = false; |
138 } | 138 } |
139 | 139 |
140 if (slider->fixed_needs_resize_) { | 140 if (slider->fixed_needs_resize_) { |
141 slider->AnimationProgressed(slider->animation_.get()); | 141 slider->AnimationProgressed(slider->animation_.get()); |
142 slider->fixed_needs_resize_ = false; | 142 slider->fixed_needs_resize_ = false; |
143 } | 143 } |
144 } | 144 } |
OLD | NEW |