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 #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 "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
13 #include "ui/base/animation/slide_animation.h" | 14 #include "ui/base/animation/slide_animation.h" |
14 #include "views/view.h" | 15 #include "views/view.h" |
15 | 16 |
16 class PanelScrollerHeader; | 17 class PanelScrollerHeader; |
17 | 18 |
18 class PanelScroller : public views::View, public ui::AnimationDelegate { | 19 class PanelScroller : public views::View, public ui::AnimationDelegate { |
19 public: | 20 public: |
20 PanelScroller(); | 21 PanelScroller(); |
21 virtual ~PanelScroller(); | 22 virtual ~PanelScroller(); |
(...skipping 10 matching lines...) Expand all Loading... |
32 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; | 33 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
33 | 34 |
34 // 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 |
35 // function will make sure the panel is fully visible. | 36 // function will make sure the panel is fully visible. |
36 void HeaderClicked(PanelScrollerHeader* source); | 37 void HeaderClicked(PanelScrollerHeader* source); |
37 | 38 |
38 private: | 39 private: |
39 struct Panel; | 40 struct Panel; |
40 | 41 |
41 // ui::AnimationDelegate overrides. | 42 // ui::AnimationDelegate overrides. |
42 virtual void AnimationProgressed(const ui::Animation* animation); | 43 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
43 | 44 |
44 // 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. |
45 void ScrollToPanel(int index); | 46 void ScrollToPanel(int index); |
46 | 47 |
47 // All panels in this scroller. | 48 // All panels in this scroller. |
48 std::vector<Panel*> panels_; | 49 std::vector<Panel*> panels_; |
49 | 50 |
50 // Height in pixels of the headers above each panel. | 51 // Height in pixels of the headers above each panel. |
51 int divider_height_; | 52 int divider_height_; |
52 | 53 |
53 bool needs_layout_; | 54 bool needs_layout_; |
54 | 55 |
55 // The current scroll position. | 56 // The current scroll position. |
56 int scroll_pos_; | 57 int scroll_pos_; |
57 | 58 |
58 ui::SlideAnimation animation_; | 59 ui::SlideAnimation animation_; |
59 | 60 |
60 // 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 |
61 // scroll. The scroll_pos_ always indicates the current one. | 62 // scroll. The scroll_pos_ always indicates the current one. |
62 int animated_scroll_begin_; | 63 int animated_scroll_begin_; |
63 int animated_scroll_end_; | 64 int animated_scroll_end_; |
64 | 65 |
65 DISALLOW_COPY_AND_ASSIGN(PanelScroller); | 66 DISALLOW_COPY_AND_ASSIGN(PanelScroller); |
66 }; | 67 }; |
67 | 68 |
68 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ | 69 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ |
OLD | NEW |