Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_overflow_strip.h |
| diff --git a/chrome/browser/ui/panels/panel_overflow_strip.h b/chrome/browser/ui/panels/panel_overflow_strip.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5ba99aa328b990fad843d039c999f8b56c0b1a3e |
| --- /dev/null |
| +++ b/chrome/browser/ui/panels/panel_overflow_strip.h |
| @@ -0,0 +1,108 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |
| +#define CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |
| +#pragma once |
| + |
| +#include "chrome/browser/ui/panels/panel.h" |
| +#include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h" |
| +#include "ui/base/animation/animation_delegate.h" |
| + |
| +class Browser; |
| +class PanelManager; |
| +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
|
| +class Point; |
| +class Size; |
| +class Rect; |
| +} |
| +namespace ui { |
| +class SlideAnimation; |
| +} |
| + |
| +// Manipulates all the panels that are placed on the left-most overflow area. |
| +class PanelOverflowStrip : public PanelMouseWatcherObserver, |
| + public ui::AnimationDelegate { |
| + public: |
| + typedef std::vector<Panel*> Panels; |
|
jennb
2011/12/02 21:16:58
IWYU: #include <vector>
jianli
2011/12/02 23:23:46
Done.
|
| + |
| + explicit PanelOverflowStrip(PanelManager* panel_manager); |
| + ~PanelOverflowStrip(); |
| + |
| + // Sets the display area of the overflow strip. |
| + // |display_area| is in screen coordinates. |
| + void SetDisplayArea(const gfx::Rect& display_area); |
| + |
| + // Adds a panel to the strip. |is_new| indicates if the panel is a newly |
| + // created panel or one that is transitioning from another grouping of panels. |
| + void AddPanel(Panel* panel, bool is_new); |
| + |
| + // Returns |false| if the panel is not in the strip. |
| + bool Remove(Panel* panel); |
| + void RemoveAll(); |
| + |
| + // 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.
|
| + // size change. |
| + void UpdatePanelRestoredSize(Panel* panel, const gfx::Size& restored_size); |
| + |
| + // 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.
|
| + void OnPanelExpansionStateChanged( |
| + Panel* panel, Panel::ExpansionState old_state); |
| + |
| + // Refreshes the layouts for all panels to reflect any possible changes. |
| + void Refresh(); |
| + |
| + 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.
|
| + int num_panels() const { return static_cast<int>(panels_.size()); } |
| + 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
|
| + |
| +#ifdef UNIT_TEST |
| + const Panels& panels() const { return panels_; } |
| +#endif |
| + |
| + private: |
| + // Overridden from PanelMouseWatcherObserver: |
| + 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.
|
| + |
| + // Overridden from AnimationDelegate: |
| + virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| + |
| + void DoRefresh(size_t start_index, size_t end_index); |
| + 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.
|
| + |
| + // Computes the layout of the |index| panel to fit into the area. |
| + // 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.
|
| + // space. |
| + gfx::Rect ComputeLayout(size_t index, |
| + const gfx::Size& iconified_size, |
| + 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.
|
| + |
| + // 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.
|
| + // the overflow area. |
| + bool ShouldShowOverflowTitles(const gfx::Point& mouse_position) const; |
| + void ShowOverflowTitles(bool show_overflow_titles); |
| + |
| + // Weak pointer since PanelManager owns PanelOverflowStrip instance. |
| + PanelManager* panel_manager_; |
| + |
| + // The queue for storing all panels. |
| + Panels panels_; |
| + |
| + // 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.
|
| + // 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.
|
| + gfx::Rect display_area_; |
| + |
| + // For mouse hover-over effect. |
| + bool are_overflow_titles_shown_; |
| + scoped_ptr<ui::SlideAnimation> overflow_hover_animator_; |
| + int overflow_hover_animator_start_width_; |
| + int overflow_hover_animator_end_width_; |
| + |
| + // Invalid panel index. |
| + static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PanelOverflowStrip); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_PANELS_PANEL_OVERFLOW_STRIP_H_ |