Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: chrome/browser/ui/panels/panel_overflow_strip.h

Issue 8949035: Revert 115297 - Add overflow indicator count on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h" 11 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h"
12 #include "ui/base/animation/animation_delegate.h" 12 #include "ui/base/animation/animation_delegate.h"
13 13
14 class Browser; 14 class Browser;
15 class PanelManager; 15 class PanelManager;
16 class PanelOverflowIndicator;
17 namespace ui { 16 namespace ui {
18 class SlideAnimation; 17 class SlideAnimation;
19 } 18 }
20 19
21 // Manipulates all the panels that are placed on the left-most overflow area. 20 // Manipulates all the panels that are placed on the left-most overflow area.
22 class PanelOverflowStrip : public PanelMouseWatcherObserver, 21 class PanelOverflowStrip : public PanelMouseWatcherObserver,
23 public ui::AnimationDelegate { 22 public ui::AnimationDelegate {
24 public: 23 public:
25 typedef std::vector<Panel*> Panels; 24 typedef std::vector<Panel*> Panels;
26 25
27 explicit PanelOverflowStrip(PanelManager* panel_manager); 26 explicit PanelOverflowStrip(PanelManager* panel_manager);
28 virtual ~PanelOverflowStrip(); 27 virtual ~PanelOverflowStrip();
29 28
30 // Sets the display area of the overflow strip. 29 // Sets the display area of the overflow strip.
31 // |display_area| is in screen coordinates. 30 // |display_area| is in screen coordinates.
32 void SetDisplayArea(const gfx::Rect& display_area); 31 void SetDisplayArea(const gfx::Rect& display_area);
33 32
34 // Adds a panel to the strip. 33 // Adds a panel to the strip.
35 void AddPanel(Panel* panel); 34 void AddPanel(Panel* panel);
36 35
37 // Returns |false| if the panel is not in the strip. 36 // Returns |false| if the panel is not in the strip.
38 bool Remove(Panel* panel); 37 bool Remove(Panel* panel);
39 void RemoveAll(); 38 void RemoveAll();
40 39
41 // Called when a panel's expansion state changes. 40 // Called when a panel's expansion state changes.
42 void OnPanelExpansionStateChanged( 41 void OnPanelExpansionStateChanged(
43 Panel* panel, Panel::ExpansionState old_state); 42 Panel* panel, Panel::ExpansionState old_state);
44 43
45 // Called when a panel is starting/stopping drawing an attention.
46 void OnPanelAttentionStateChanged(Panel* panel);
47
48 // Refreshes the layouts for all panels to reflect any possible changes. 44 // Refreshes the layouts for all panels to reflect any possible changes.
49 void Refresh(); 45 void Refresh();
50 46
51 void OnFullScreenModeChanged(bool is_full_screen); 47 void OnFullScreenModeChanged(bool is_full_screen);
52 48
53 int num_panels() const { return static_cast<int>(panels_.size()); } 49 int num_panels() const { return static_cast<int>(panels_.size()); }
54 Panel* first_panel() const { 50 Panel* first_panel() const {
55 return panels_.empty() ? NULL : panels_.front(); 51 return panels_.empty() ? NULL : panels_.front();
56 } 52 }
57 const Panels& panels() const { return panels_; } 53 const Panels& panels() const { return panels_; }
58 54
59 #ifdef UNIT_TEST 55 #ifdef UNIT_TEST
60 int current_display_width() const { return current_display_width_; } 56 int current_display_width() const { return current_display_width_; }
61 57
62 // This might return NULL.
63 PanelOverflowIndicator* overflow_indicator() const {
64 return overflow_indicator_.get();
65 }
66
67 void set_max_visible_panels(int max_visible_panels) { 58 void set_max_visible_panels(int max_visible_panels) {
68 max_visible_panels_ = max_visible_panels; 59 max_visible_panels_ = max_visible_panels;
69 } 60 }
70
71 void set_max_visible_panels_on_hover(int max_visible_panels_on_hover) {
72 max_visible_panels_on_hover_ = max_visible_panels_on_hover;
73 }
74 #endif 61 #endif
75 62
76 private: 63 private:
77 // Overridden from PanelMouseWatcherObserver: 64 // Overridden from PanelMouseWatcherObserver:
78 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE; 65 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
79 66
80 // Overridden from AnimationDelegate: 67 // Overridden from AnimationDelegate:
81 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 68 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
82 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 69 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
83 70
84 void UpdateCurrentWidth(); 71 void UpdateCurrentWidth();
85 72
86 void DoRefresh(size_t start_index, size_t end_index); 73 void DoRefresh(size_t start_index, size_t end_index);
87 74
88 // Used to update the overflow indicator.
89 void UpdateMaxVisiblePanelsOnHover();
90 void UpdateOverflowIndicatorCount();
91 void UpdateOverflowIndicatorAttention();
92
93 // 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.
94 // 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
95 // space. 77 // space.
96 gfx::Rect ComputeLayout(size_t index, 78 gfx::Rect ComputeLayout(size_t index,
97 const gfx::Size& iconified_size) const; 79 const gfx::Size& iconified_size) const;
98 80
99 // 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
100 // the overflow area. 82 // the overflow area.
101 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const; 83 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const;
102 void ShowOverflowTitles(bool show_overflow_titles); 84 void ShowOverflowTitles(bool show_overflow_titles);
103 85
104 int max_visible_panels() const {
105 return are_overflow_titles_shown_ ? max_visible_panels_on_hover_
106 : max_visible_panels_;
107 }
108
109 // Weak pointer since PanelManager owns PanelOverflowStrip instance. 86 // Weak pointer since PanelManager owns PanelOverflowStrip instance.
110 PanelManager* panel_manager_; 87 PanelManager* panel_manager_;
111 88
112 // The queue for storing all panels. 89 // The queue for storing all panels.
113 Panels panels_; 90 Panels panels_;
114 91
115 // The overflow area where panels are iconified due to insufficient space 92 // The overflow area where panels are iconified due to insufficient space
116 // in the panel strip. 93 // in the panel strip.
117 gfx::Rect display_area_; 94 gfx::Rect display_area_;
118 95
119 // Current width of the overflow area. It is the width of the panel in the 96 // Current width of the overflow area. It is the width of the panel in the
120 // iconified state when the mouse does not hover over it, or the width of 97 // iconified state when the mouse does not hover over it, or the width of
121 // the panel showing more info when the mouse hovers over it. 98 // the panel showing more info when the mouse hovers over it.
122 int current_display_width_; 99 int current_display_width_;
123 100
124 // Maximium number of overflow panels allowed to be shown when the mouse 101 // Maximium number of overflow panels allowed to be shown.
125 // does not hover over the overflow area.
126 int max_visible_panels_; 102 int max_visible_panels_;
127 103
128 // Maximium number of overflow panels allowed to be shown when the mouse
129 // hovers over the overflow area and causes it to be expanded.
130 int max_visible_panels_on_hover_;
131
132 // Used to show "+N" indicator when number of overflow panels exceed
133 // |max_visible_panels_|.
134 scoped_ptr<PanelOverflowIndicator> overflow_indicator_;
135
136 // For mouse hover-over effect. 104 // For mouse hover-over effect.
137 bool are_overflow_titles_shown_; 105 bool are_overflow_titles_shown_;
138 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_; 106 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_;
139 int overflow_hover_animator_start_width_; 107 int overflow_hover_animator_start_width_;
140 int overflow_hover_animator_end_width_; 108 int overflow_hover_animator_end_width_;
141 109
142 // Invalid panel index. 110 // Invalid panel index.
143 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); 111 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
144 112
145 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip); 113 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip);
146 }; 114 };
147 115
148 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ 116 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_indicator_view.cc ('k') | chrome/browser/ui/panels/panel_overflow_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698