OLD | NEW |
1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ |
6 #define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ | 6 #define CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
11 #include "app/animation_delegate.h" | |
12 #include "app/slide_animation.h" | |
13 #include "base/callback.h" | 11 #include "base/callback.h" |
14 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
15 #include "base/task.h" | 13 #include "base/task.h" |
16 #include "gfx/canvas.h" | 14 #include "gfx/canvas.h" |
17 #include "gfx/point.h" | 15 #include "gfx/point.h" |
18 #include "gfx/rect.h" | 16 #include "gfx/rect.h" |
19 #include "gfx/size.h" | 17 #include "gfx/size.h" |
| 18 #include "ui/base/animation/animation_delegate.h" |
| 19 #include "ui/base/animation/slide_animation.h" |
20 | 20 |
21 class TabContents; | 21 class TabContents; |
22 class TabRendererGtk; | 22 class TabRendererGtk; |
23 | 23 |
24 class DraggedTabGtk : public AnimationDelegate { | 24 class DraggedTabGtk : public ui::AnimationDelegate { |
25 public: | 25 public: |
26 DraggedTabGtk(TabContents* datasource, | 26 DraggedTabGtk(TabContents* datasource, |
27 const gfx::Point& mouse_tab_offset, | 27 const gfx::Point& mouse_tab_offset, |
28 const gfx::Size& contents_size, | 28 const gfx::Size& contents_size, |
29 bool mini); | 29 bool mini); |
30 virtual ~DraggedTabGtk(); | 30 virtual ~DraggedTabGtk(); |
31 | 31 |
32 // Moves the dragged tab to the appropriate location given the mouse | 32 // Moves the dragged tab to the appropriate location given the mouse |
33 // pointer at |screen_point|. | 33 // pointer at |screen_point|. |
34 void MoveTo(const gfx::Point& screen_point); | 34 void MoveTo(const gfx::Point& screen_point); |
(...skipping 21 matching lines...) Expand all Loading... |
56 void AnimateToBounds(const gfx::Rect& bounds, | 56 void AnimateToBounds(const gfx::Rect& bounds, |
57 AnimateToBoundsCallback* callback); | 57 AnimateToBoundsCallback* callback); |
58 | 58 |
59 // Returns the size of the dragged tab. Used when attaching to a tabstrip | 59 // Returns the size of the dragged tab. Used when attaching to a tabstrip |
60 // to determine where to place the tab in the attached tabstrip. | 60 // to determine where to place the tab in the attached tabstrip. |
61 const gfx::Size& attached_tab_size() const { return attached_tab_size_; } | 61 const gfx::Size& attached_tab_size() const { return attached_tab_size_; } |
62 | 62 |
63 GtkWidget* widget() const { return container_; } | 63 GtkWidget* widget() const { return container_; } |
64 | 64 |
65 private: | 65 private: |
66 // Overridden from AnimationDelegate: | 66 // Overridden from ui::AnimationDelegate: |
67 virtual void AnimationProgressed(const Animation* animation); | 67 virtual void AnimationProgressed(const ui::Animation* animation); |
68 virtual void AnimationEnded(const Animation* animation); | 68 virtual void AnimationEnded(const ui::Animation* animation); |
69 virtual void AnimationCanceled(const Animation* animation); | 69 virtual void AnimationCanceled(const ui::Animation* animation); |
70 | 70 |
71 // Arranges the contents of the dragged tab. | 71 // Arranges the contents of the dragged tab. |
72 void Layout(); | 72 void Layout(); |
73 | 73 |
74 // Gets the preferred size of the dragged tab. | 74 // Gets the preferred size of the dragged tab. |
75 gfx::Size GetPreferredSize(); | 75 gfx::Size GetPreferredSize(); |
76 | 76 |
77 // Resizes the container to fit the content for the current attachment mode. | 77 // Resizes the container to fit the content for the current attachment mode. |
78 void ResizeContainer(); | 78 void ResizeContainer(); |
79 | 79 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 gfx::Point mouse_tab_offset_; | 125 gfx::Point mouse_tab_offset_; |
126 | 126 |
127 // The size of the tab renderer when the dragged tab is attached to a | 127 // The size of the tab renderer when the dragged tab is attached to a |
128 // tabstrip. | 128 // tabstrip. |
129 gfx::Size attached_tab_size_; | 129 gfx::Size attached_tab_size_; |
130 | 130 |
131 // The dimensions of the TabContents being dragged. | 131 // The dimensions of the TabContents being dragged. |
132 gfx::Size contents_size_; | 132 gfx::Size contents_size_; |
133 | 133 |
134 // The animation used to slide the attached tab to its final location. | 134 // The animation used to slide the attached tab to its final location. |
135 SlideAnimation close_animation_; | 135 ui::SlideAnimation close_animation_; |
136 | 136 |
137 // A callback notified when the animation is complete. | 137 // A callback notified when the animation is complete. |
138 scoped_ptr<Callback0::Type> animation_callback_; | 138 scoped_ptr<Callback0::Type> animation_callback_; |
139 | 139 |
140 // The start and end bounds of the animation sequence. | 140 // The start and end bounds of the animation sequence. |
141 gfx::Rect animation_start_bounds_; | 141 gfx::Rect animation_start_bounds_; |
142 gfx::Rect animation_end_bounds_; | 142 gfx::Rect animation_end_bounds_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(DraggedTabGtk); | 144 DISALLOW_COPY_AND_ASSIGN(DraggedTabGtk); |
145 }; | 145 }; |
146 | 146 |
147 #endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ | 147 #endif // CHROME_BROWSER_GTK_TABS_DRAGGED_TAB_GTK_H_ |
OLD | NEW |