OLD | NEW |
1 // Copyright (c) 2010 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 "ui/base/animation/animation_delegate.h" | 12 #include "ui/base/animation/animation_delegate.h" |
13 #include "ui/base/animation/slide_animation.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 ui::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 // Overridden from View: |
26 virtual void ViewHierarchyChanged(bool is_add, | 26 virtual gfx::Size GetPreferredSize() OVERRIDE; |
27 views::View* parent, | 27 virtual void Layout() OVERRIDE; |
28 views::View* child); | 28 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
29 virtual gfx::Size GetPreferredSize(); | 29 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; |
30 virtual void Layout(); | |
31 virtual bool OnMousePressed(const views::MouseEvent& event); | |
32 virtual bool OnMouseDragged(const views::MouseEvent& event); | |
33 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | |
34 | 30 |
35 // Called when a panel header is clicked with the affected container. This | 31 // Called when a panel header is clicked with the affected container. This |
36 // function will make sure the panel is fully visible. | 32 // function will make sure the panel is fully visible. |
37 void HeaderClicked(PanelScrollerHeader* source); | 33 void HeaderClicked(PanelScrollerHeader* source); |
38 | 34 |
| 35 protected: |
| 36 // Overridden from View: |
| 37 virtual void ViewHierarchyChanged(bool is_add, |
| 38 views::View* parent, |
| 39 views::View* child) OVERRIDE; |
| 40 |
39 private: | 41 private: |
40 struct Panel; | 42 struct Panel; |
41 | 43 |
42 // ui::AnimationDelegate overrides. | 44 // ui::AnimationDelegate overrides. |
43 virtual void AnimationProgressed(const ui::Animation* animation); | 45 virtual void AnimationProgressed(const ui::Animation* animation); |
44 | 46 |
45 // Scrolls to the panel at the given index. It will be moved to the top. | 47 // Scrolls to the panel at the given index. It will be moved to the top. |
46 void ScrollToPanel(int index); | 48 void ScrollToPanel(int index); |
47 | 49 |
48 // All panels in this scroller. | 50 // All panels in this scroller. |
(...skipping 12 matching lines...) Expand all Loading... |
61 // When animating a scroll, these indicate the beginning and ending of the | 63 // When animating a scroll, these indicate the beginning and ending of the |
62 // scroll. The scroll_pos_ always indicates the current one. | 64 // scroll. The scroll_pos_ always indicates the current one. |
63 int animated_scroll_begin_; | 65 int animated_scroll_begin_; |
64 int animated_scroll_end_; | 66 int animated_scroll_end_; |
65 | 67 |
66 DISALLOW_COPY_AND_ASSIGN(PanelScroller); | 68 DISALLOW_COPY_AND_ASSIGN(PanelScroller); |
67 }; | 69 }; |
68 | 70 |
69 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ | 71 #endif // CHROME_BROWSER_CHROMEOS_PANELS_PANEL_SCROLLER_H_ |
70 | 72 |
OLD | NEW |