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

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

Issue 8776035: Add PanelOverflowStrip to handle panel overflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prepare for final landing 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
7 #pragma once
8
9 #include <vector>
10 #include "chrome/browser/ui/panels/panel.h"
11 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h"
12 #include "ui/base/animation/animation_delegate.h"
13
14 class Browser;
15 class PanelManager;
16 namespace ui {
17 class SlideAnimation;
18 }
19
20 // Manipulates all the panels that are placed on the left-most overflow area.
21 class PanelOverflowStrip : public PanelMouseWatcherObserver,
22 public ui::AnimationDelegate {
23 public:
24 typedef std::vector<Panel*> Panels;
25
26 explicit PanelOverflowStrip(PanelManager* panel_manager);
27 virtual ~PanelOverflowStrip();
28
29 // Sets the display area of the overflow strip.
30 // |display_area| is in screen coordinates.
31 void SetDisplayArea(const gfx::Rect& display_area);
32
33 // Adds a panel to the strip. |is_new| indicates if the panel is a newly
34 // created panel or one that is transitioning from another grouping of panels.
35 void AddPanel(Panel* panel, bool is_new);
36
37 // Returns |false| if the panel is not in the strip.
38 bool Remove(Panel* panel);
39 void RemoveAll();
40
41 // Called when a panel's expansion state changes.
42 void OnPanelExpansionStateChanged(
43 Panel* panel, Panel::ExpansionState old_state);
44
45 // Refreshes the layouts for all panels to reflect any possible changes.
46 void Refresh();
47
48 void OnFullScreenModeChanged(bool is_full_screen);
49
50 int num_panels() const { return static_cast<int>(panels_.size()); }
51 Panel* first_panel() const {
52 return panels_.empty() ? NULL : panels_.front();
53 }
54
55 #ifdef UNIT_TEST
56 const Panels& panels() const { return panels_; }
57 #endif
58
59 private:
60 // Overridden from PanelMouseWatcherObserver:
61 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
62
63 // Overridden from AnimationDelegate:
64 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
65
66 void DoRefresh(size_t start_index, size_t end_index);
67
68 // Computes the layout of the |index| panel to fit into the area.
69 // Empty bounds will be returned if this is not possible due to not enough
70 // space.
71 gfx::Rect ComputeLayout(size_t index,
72 const gfx::Size& iconified_size) const;
73
74 // Used to pop up the titles for overflow panels when the mouse hovers over
75 // the overflow area.
76 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const;
77 void ShowOverflowTitles(bool show_overflow_titles);
78
79 // Weak pointer since PanelManager owns PanelOverflowStrip instance.
80 PanelManager* panel_manager_;
81
82 // The queue for storing all panels.
83 Panels panels_;
84
85 // The overflow area where panels are iconified due to insufficient space
86 // in the panel strip.
87 gfx::Rect display_area_;
88
89 // For mouse hover-over effect.
90 bool are_overflow_titles_shown_;
91 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_;
92 int overflow_hover_animator_start_width_;
93 int overflow_hover_animator_end_width_;
94
95 // Invalid panel index.
96 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
97
98 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip);
99 };
100
101 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.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