OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tabs/dragged_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 gint x, y, width, height; | 209 gint x, y, width, height; |
210 GdkWindow* gdk_window = gtk_widget_get_window(container_); | 210 GdkWindow* gdk_window = gtk_widget_get_window(container_); |
211 gdk_window_get_origin(gdk_window, &x, &y); | 211 gdk_window_get_origin(gdk_window, &x, &y); |
212 gdk_window_get_geometry(gdk_window, NULL, NULL, | 212 gdk_window_get_geometry(gdk_window, NULL, NULL, |
213 &width, &height, NULL); | 213 &width, &height, NULL); |
214 | 214 |
215 animation_start_bounds_ = gfx::Rect(x, y, width, height); | 215 animation_start_bounds_ = gfx::Rect(x, y, width, height); |
216 animation_end_bounds_ = bounds; | 216 animation_end_bounds_ = bounds; |
217 | 217 |
218 close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs); | 218 close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs); |
219 close_animation_.SetTweenType(ui::Tween::EASE_OUT); | 219 close_animation_.SetTweenType(gfx::Tween::EASE_OUT); |
220 if (!close_animation_.IsShowing()) { | 220 if (!close_animation_.IsShowing()) { |
221 close_animation_.Reset(); | 221 close_animation_.Reset(); |
222 close_animation_.Show(); | 222 close_animation_.Show(); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 //////////////////////////////////////////////////////////////////////////////// | 226 //////////////////////////////////////////////////////////////////////////////// |
227 // DraggedViewGtk, ui::AnimationDelegate implementation: | 227 // DraggedViewGtk, gfx::AnimationDelegate implementation: |
228 | 228 |
229 void DraggedViewGtk::AnimationProgressed(const ui::Animation* animation) { | 229 void DraggedViewGtk::AnimationProgressed(const gfx::Animation* animation) { |
230 int delta_x = (animation_end_bounds_.x() - animation_start_bounds_.x()); | 230 int delta_x = (animation_end_bounds_.x() - animation_start_bounds_.x()); |
231 int x = animation_start_bounds_.x() + | 231 int x = animation_start_bounds_.x() + |
232 static_cast<int>(delta_x * animation->GetCurrentValue()); | 232 static_cast<int>(delta_x * animation->GetCurrentValue()); |
233 int y = animation_end_bounds_.y(); | 233 int y = animation_end_bounds_.y(); |
234 GdkWindow* gdk_window = gtk_widget_get_window(container_); | 234 GdkWindow* gdk_window = gtk_widget_get_window(container_); |
235 gdk_window_move(gdk_window, x, y); | 235 gdk_window_move(gdk_window, x, y); |
236 } | 236 } |
237 | 237 |
238 void DraggedViewGtk::AnimationEnded(const ui::Animation* animation) { | 238 void DraggedViewGtk::AnimationEnded(const gfx::Animation* animation) { |
239 animation_callback_.Run(); | 239 animation_callback_.Run(); |
240 } | 240 } |
241 | 241 |
242 void DraggedViewGtk::AnimationCanceled(const ui::Animation* animation) { | 242 void DraggedViewGtk::AnimationCanceled(const gfx::Animation* animation) { |
243 AnimationEnded(animation); | 243 AnimationEnded(animation); |
244 } | 244 } |
245 | 245 |
246 //////////////////////////////////////////////////////////////////////////////// | 246 //////////////////////////////////////////////////////////////////////////////// |
247 // DraggedViewGtk, private: | 247 // DraggedViewGtk, private: |
248 | 248 |
249 void DraggedViewGtk::Layout() { | 249 void DraggedViewGtk::Layout() { |
250 if (attached_) { | 250 if (attached_) { |
251 for (size_t i = 0; i < renderers_.size(); i++) { | 251 for (size_t i = 0; i < renderers_.size(); i++) { |
252 gfx::Rect rect(GetPreferredSize()); | 252 gfx::Rect rect(GetPreferredSize()); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 if (!attached_) { | 464 if (!attached_) { |
465 paint_at = widget_width / kScalingFactor - | 465 paint_at = widget_width / kScalingFactor - |
466 GetWidthInTabStripFromTo(0, index + 1); | 466 GetWidthInTabStripFromTo(0, index + 1); |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 cairo_set_source_surface(cr, surface, paint_at, 0); | 470 cairo_set_source_surface(cr, surface, paint_at, 0); |
471 cairo_paint(cr); | 471 cairo_paint(cr); |
472 cairo_surface_destroy(surface); | 472 cairo_surface_destroy(surface); |
473 } | 473 } |
OLD | NEW |