OLD | NEW |
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 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 5 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
6 | 6 |
7 #include "ui/base/animation/animation.h" | 7 #include "ui/base/animation/animation.h" |
8 #include "ui/base/animation/slide_animation.h" | 8 #include "ui/base/animation/slide_animation.h" |
9 #include "ui/base/gtk/gtk_expanded_container.h" | 9 #include "ui/base/gtk/gtk_expanded_container.h" |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return animation_->is_animating(); | 112 return animation_->is_animating(); |
113 } | 113 } |
114 | 114 |
115 void SlideAnimatorGtk::AnimationProgressed(const ui::Animation* animation) { | 115 void SlideAnimatorGtk::AnimationProgressed(const ui::Animation* animation) { |
116 GtkRequisition req; | 116 GtkRequisition req; |
117 gtk_widget_size_request(child_, &req); | 117 gtk_widget_size_request(child_, &req); |
118 | 118 |
119 int showing_height = static_cast<int>(req.height * | 119 int showing_height = static_cast<int>(req.height * |
120 animation_->GetCurrentValue()); | 120 animation_->GetCurrentValue()); |
121 if (direction_ == DOWN) { | 121 if (direction_ == DOWN) { |
122 if (widget_.get()->parent) { | 122 if (gtk_widget_get_parent(widget_.get())) { |
123 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()), | 123 gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()), |
124 child_, 0, showing_height - req.height); | 124 child_, 0, showing_height - req.height); |
125 } | 125 } |
126 child_needs_move_ = false; | 126 child_needs_move_ = false; |
127 } | 127 } |
128 gtk_widget_set_size_request(widget_.get(), -1, showing_height); | 128 gtk_widget_set_size_request(widget_.get(), -1, showing_height); |
129 } | 129 } |
130 | 130 |
131 void SlideAnimatorGtk::AnimationEnded(const ui::Animation* animation) { | 131 void SlideAnimatorGtk::AnimationEnded(const ui::Animation* animation) { |
132 if (!animation_->IsShowing()) { | 132 if (!animation_->IsShowing()) { |
(...skipping 11 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 |