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