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_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Refreshes the layouts for all panels to reflect any possible changes. | 44 // Refreshes the layouts for all panels to reflect any possible changes. |
45 void Refresh(); | 45 void Refresh(); |
46 | 46 |
47 void OnFullScreenModeChanged(bool is_full_screen); | 47 void OnFullScreenModeChanged(bool is_full_screen); |
48 | 48 |
49 int num_panels() const { return static_cast<int>(panels_.size()); } | 49 int num_panels() const { return static_cast<int>(panels_.size()); } |
50 Panel* first_panel() const { | 50 Panel* first_panel() const { |
51 return panels_.empty() ? NULL : panels_.front(); | 51 return panels_.empty() ? NULL : panels_.front(); |
52 } | 52 } |
| 53 const Panels& panels() const { return panels_; } |
53 | 54 |
54 #ifdef UNIT_TEST | 55 #ifdef UNIT_TEST |
55 const Panels& panels() const { return panels_; } | 56 int current_display_width() const { return current_display_width_; } |
| 57 |
| 58 void set_max_visible_panels(int max_visible_panels) { |
| 59 max_visible_panels_ = max_visible_panels; |
| 60 } |
56 #endif | 61 #endif |
57 | 62 |
58 private: | 63 private: |
59 // Overridden from PanelMouseWatcherObserver: | 64 // Overridden from PanelMouseWatcherObserver: |
60 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; | 65 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; |
61 | 66 |
62 // Overridden from AnimationDelegate: | 67 // Overridden from AnimationDelegate: |
| 68 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
63 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 69 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
64 | 70 |
| 71 void UpdateCurrentWidth(); |
| 72 |
65 void DoRefresh(size_t start_index, size_t end_index); | 73 void DoRefresh(size_t start_index, size_t end_index); |
66 | 74 |
67 // Computes the layout of the |index| panel to fit into the area. | 75 // Computes the layout of the |index| panel to fit into the area. |
68 // Empty bounds will be returned if this is not possible due to not enough | 76 // Empty bounds will be returned if this is not possible due to not enough |
69 // space. | 77 // space. |
70 gfx::Rect ComputeLayout(size_t index, | 78 gfx::Rect ComputeLayout(size_t index, |
71 const gfx::Size& iconified_size) const; | 79 const gfx::Size& iconified_size) const; |
72 | 80 |
73 // Used to pop up the titles for overflow panels when the mouse hovers over | 81 // Used to pop up the titles for overflow panels when the mouse hovers over |
74 // the overflow area. | 82 // the overflow area. |
75 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const; | 83 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const; |
76 void ShowOverflowTitles(bool show_overflow_titles); | 84 void ShowOverflowTitles(bool show_overflow_titles); |
77 | 85 |
78 // Weak pointer since PanelManager owns PanelOverflowStrip instance. | 86 // Weak pointer since PanelManager owns PanelOverflowStrip instance. |
79 PanelManager* panel_manager_; | 87 PanelManager* panel_manager_; |
80 | 88 |
81 // The queue for storing all panels. | 89 // The queue for storing all panels. |
82 Panels panels_; | 90 Panels panels_; |
83 | 91 |
84 // The overflow area where panels are iconified due to insufficient space | 92 // The overflow area where panels are iconified due to insufficient space |
85 // in the panel strip. | 93 // in the panel strip. |
86 gfx::Rect display_area_; | 94 gfx::Rect display_area_; |
87 | 95 |
| 96 // Current width of the overflow area. It is the width of the panel in the |
| 97 // iconified state when the mouse does not hover over it, or the width of |
| 98 // the panel showing more info when the mouse hovers over it. |
| 99 int current_display_width_; |
| 100 |
| 101 // Maximium number of overflow panels allowed to be shown. |
| 102 int max_visible_panels_; |
| 103 |
88 // For mouse hover-over effect. | 104 // For mouse hover-over effect. |
89 bool are_overflow_titles_shown_; | 105 bool are_overflow_titles_shown_; |
90 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_; | 106 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_; |
91 int overflow_hover_animator_start_width_; | 107 int overflow_hover_animator_start_width_; |
92 int overflow_hover_animator_end_width_; | 108 int overflow_hover_animator_end_width_; |
93 | 109 |
94 // Invalid panel index. | 110 // Invalid panel index. |
95 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); | 111 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); |
96 | 112 |
97 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip); | 113 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip); |
98 }; | 114 }; |
99 | 115 |
100 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ | 116 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |
OLD | NEW |