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

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: Fix 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 "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h"
11 #include "ui/base/animation/animation_delegate.h"
12
13 class Browser;
14 class PanelManager;
15 namespace gfx {
jennb 2011/12/02 21:16:58 Looks like I forgot to put this in panel_strip.h.
jianli 2011/12/02 23:23:46 Indeed it is not needed since I include gfx/rect.h
16 class Point;
17 class Size;
18 class Rect;
19 }
20 namespace ui {
21 class SlideAnimation;
22 }
23
24 // Manipulates all the panels that are placed on the left-most overflow area.
25 class PanelOverflowStrip : public PanelMouseWatcherObserver,
26 public ui::AnimationDelegate {
27 public:
28 typedef std::vector<Panel*> Panels;
jennb 2011/12/02 21:16:58 IWYU: #include <vector>
jianli 2011/12/02 23:23:46 Done.
29
30 explicit PanelOverflowStrip(PanelManager* panel_manager);
31 ~PanelOverflowStrip();
32
33 // Sets the display area of the overflow strip.
34 // |display_area| is in screen coordinates.
35 void SetDisplayArea(const gfx::Rect& display_area);
36
37 // Adds a panel to the strip. |is_new| indicates if the panel is a newly
38 // created panel or one that is transitioning from another grouping of panels.
39 void AddPanel(Panel* panel, bool is_new);
40
41 // Returns |false| if the panel is not in the strip.
42 bool Remove(Panel* panel);
43 void RemoveAll();
44
45 // Updates the restored size of the given panel due to the preferred content
jennb 2011/12/02 21:16:58 Don't need this in overflow strip. Rather, change
jianli 2011/12/02 23:23:46 Removed. This is a leftover.
46 // size change.
47 void UpdatePanelRestoredSize(Panel* panel, const gfx::Size& restored_size);
48
49 // called when a panel's expansion state changes.
jennb 2011/12/02 21:16:58 nit: Called
jianli 2011/12/02 23:23:46 Done.
50 void OnPanelExpansionStateChanged(
51 Panel* panel, Panel::ExpansionState old_state);
52
53 // Refreshes the layouts for all panels to reflect any possible changes.
54 void Refresh();
55
56 bool mouse_watcher_needed() const;
jennb 2011/12/02 21:16:58 Delete, not used. (or I couldn't find it's usage).
jianli 2011/12/02 23:23:46 Done.
57 int num_panels() const { return static_cast<int>(panels_.size()); }
58 Panel* first_panel() const;
jennb 2011/12/02 21:16:58 nit: FirstPanel(). I thought only inline accessors
jianli 2011/12/02 23:23:46 Move the code here so we don't need to change the
59
60 #ifdef UNIT_TEST
61 const Panels& panels() const { return panels_; }
62 #endif
63
64 private:
65 // Overridden from PanelMouseWatcherObserver:
66 virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
jennb 2011/12/02 21:16:58 Could you make the one in panel_strip.h private to
jianli 2011/12/02 23:23:46 Done.
67
68 // Overridden from AnimationDelegate:
69 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
70
71 void DoRefresh(size_t start_index, size_t end_index);
72 size_t FindPanelIndex(Panel* panel) const;
jennb 2011/12/02 21:16:58 Can get rid of this. See comment in .cc file.
jianli 2011/12/02 23:23:46 Done.
73
74 // Computes the layout of the |index| panel to fit into the area.
75 // Empty bounds will be returned if this is not possible due to no enough
jennb 2011/12/02 21:16:58 typo: no enough
jianli 2011/12/02 23:23:46 Done.
76 // space.
77 gfx::Rect ComputeLayout(size_t index,
78 const gfx::Size& iconified_size,
79 const gfx::Size& restored_size) const;
jennb 2011/12/02 21:16:58 restored_size is a concept that is only for the pa
jianli 2011/12/02 23:23:46 Removed. This is a leftover.
80
81 // Used to pop up the titles for overflow panels, when the mouse hovers over
jennb 2011/12/02 21:16:58 nit: no comma needed in sentence.
jianli 2011/12/02 23:23:46 Done.
82 // the overflow area.
83 bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const;
84 void ShowOverflowTitles(bool show_overflow_titles);
85
86 // Weak pointer since PanelManager owns PanelOverflowStrip instance.
87 PanelManager* panel_manager_;
88
89 // The queue for storing all panels.
90 Panels panels_;
91
92 // The overflow area where panels are iconified due to no available space
jennb 2011/12/02 21:16:58 s/no available/insufficient
jianli 2011/12/02 23:23:46 Done.
93 // in the normal docking area.
jennb 2011/12/02 21:16:58 s/docking area/panel strip - as we call it panel
jianli 2011/12/02 23:23:46 Done.
94 gfx::Rect display_area_;
95
96 // For mouse hover-over effect.
97 bool are_overflow_titles_shown_;
98 scoped_ptr<ui::SlideAnimation> overflow_hover_animator_;
99 int overflow_hover_animator_start_width_;
100 int overflow_hover_animator_end_width_;
101
102 // Invalid panel index.
103 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1);
104
105 DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip);
106 };
107
108 #endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698