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_CHROMEOS_PANELS_PANEL_SCROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "app/animation_delegate.h" | |
12 #include "app/slide_animation.h" | |
13 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "ui/base/animation/animation_delegate.h" |
| 13 #include "ui/base/animation/slide_animation.h" |
14 #include "views/view.h" | 14 #include "views/view.h" |
15 | 15 |
16 class PanelScrollerHeader; | 16 class PanelScrollerHeader; |
17 | 17 |
18 class PanelScroller : public views::View, public AnimationDelegate { | 18 class PanelScroller : public views::View, public ui::AnimationDelegate { |
19 public: | 19 public: |
20 PanelScroller(); | 20 PanelScroller(); |
21 ~PanelScroller(); | 21 ~PanelScroller(); |
22 | 22 |
23 static PanelScroller* CreateWindow(); | 23 static PanelScroller* CreateWindow(); |
24 | 24 |
25 // View overrides. | 25 // View overrides. |
26 virtual void ViewHierarchyChanged(bool is_add, | 26 virtual void ViewHierarchyChanged(bool is_add, |
27 views::View* parent, | 27 views::View* parent, |
28 views::View* child); | 28 views::View* child); |
29 virtual gfx::Size GetPreferredSize(); | 29 virtual gfx::Size GetPreferredSize(); |
30 virtual void Layout(); | 30 virtual void Layout(); |
31 virtual bool OnMousePressed(const views::MouseEvent& event); | 31 virtual bool OnMousePressed(const views::MouseEvent& event); |
32 virtual bool OnMouseDragged(const views::MouseEvent& event); | 32 virtual bool OnMouseDragged(const views::MouseEvent& event); |
33 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 33 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
34 | 34 |
35 // Called when a panel header is clicked with the affected container. This | 35 // Called when a panel header is clicked with the affected container. This |
36 // function will make sure the panel is fully visible. | 36 // function will make sure the panel is fully visible. |
37 void HeaderClicked(PanelScrollerHeader* source); | 37 void HeaderClicked(PanelScrollerHeader* source); |
38 | 38 |
39 private: | 39 private: |
40 struct Panel; | 40 struct Panel; |
41 | 41 |
42 // AnimationDelegate overrides. | 42 // ui::AnimationDelegate overrides. |
43 virtual void AnimationProgressed(const Animation* animation); | 43 virtual void AnimationProgressed(const ui::Animation* animation); |
44 | 44 |
45 // Scrolls to the panel at the given index. It will be moved to the top. | 45 // Scrolls to the panel at the given index. It will be moved to the top. |
46 void ScrollToPanel(int index); | 46 void ScrollToPanel(int index); |
47 | 47 |
48 // All panels in this scroller. | 48 // All panels in this scroller. |
49 std::vector<Panel*> panels_; | 49 std::vector<Panel*> panels_; |
50 | 50 |
51 // Height in pixels of the headers above each panel. | 51 // Height in pixels of the headers above each panel. |
52 int divider_height_; | 52 int divider_height_; |
53 | 53 |
54 bool needs_layout_; | 54 bool needs_layout_; |
55 | 55 |
56 // The current scroll position. | 56 // The current scroll position. |
57 int scroll_pos_; | 57 int scroll_pos_; |
58 | 58 |
59 SlideAnimation animation_; | 59 ui::SlideAnimation animation_; |
60 | 60 |
61 // When animating a scroll, these indicate the beginning and ending of the | 61 // When animating a scroll, these indicate the beginning and ending of the |
62 // scroll. The scroll_pos_ always indicates the current one. | 62 // scroll. The scroll_pos_ always indicates the current one. |
63 int animated_scroll_begin_; | 63 int animated_scroll_begin_; |
64 int animated_scroll_end_; | 64 int animated_scroll_end_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(PanelScroller); | 66 DISALLOW_COPY_AND_ASSIGN(PanelScroller); |
67 }; | 67 }; |
68 | 68 |
69 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ | 69 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ |
70 | 70 |
OLD | NEW |