OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OVERFLOW_PANEL_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_OVERFLOW_PANEL_STRIP_H_ |
6 #define CHROME_BROWSER_UI_PANELS_OVERFLOW_PANEL_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_OVERFLOW_PANEL_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_strip.h" |
11 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h" | 12 #include "chrome/browser/ui/panels/panel_mouse_watcher_observer.h" |
12 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
13 | 14 |
14 class Browser; | 15 class Browser; |
15 class PanelManager; | 16 class PanelManager; |
16 class PanelOverflowIndicator; | 17 class PanelOverflowIndicator; |
17 namespace ui { | 18 namespace ui { |
18 class SlideAnimation; | 19 class SlideAnimation; |
19 } | 20 } |
20 | 21 |
21 // Manipulates all the panels that are placed on the left-most overflow area. | 22 // Manipulates all the panels that are placed on the left-most overflow area. |
22 class OverflowPanelStrip : public PanelMouseWatcherObserver, | 23 class OverflowPanelStrip : public PanelStrip, |
| 24 public PanelMouseWatcherObserver, |
23 public ui::AnimationDelegate { | 25 public ui::AnimationDelegate { |
24 public: | 26 public: |
25 typedef std::vector<Panel*> Panels; | 27 typedef std::vector<Panel*> Panels; |
26 | 28 |
27 explicit OverflowPanelStrip(PanelManager* panel_manager); | 29 explicit OverflowPanelStrip(PanelManager* panel_manager); |
28 virtual ~OverflowPanelStrip(); | 30 virtual ~OverflowPanelStrip(); |
29 | 31 |
30 // Sets the display area of the overflow strip. | 32 // PanelStrip OVERRIDES: |
31 // |display_area| is in screen coordinates. | 33 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; |
32 void SetDisplayArea(const gfx::Rect& display_area); | 34 virtual void RefreshLayout() OVERRIDE; |
33 | 35 virtual void AddPanel(Panel* panel) OVERRIDE; |
34 // Adds a panel to the strip. | 36 virtual bool RemovePanel(Panel* panel) OVERRIDE; |
35 void AddPanel(Panel* panel); | 37 virtual void CloseAll() OVERRIDE; |
36 | 38 virtual void ResizePanelWindow( |
37 // Returns |false| if the panel is not in the strip. | 39 Panel* panel, |
38 bool Remove(Panel* panel); | 40 const gfx::Size& preferred_window_size) OVERRIDE; |
39 void RemoveAll(); | 41 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
40 | 42 |
41 // Called when a panel's expansion state changes. | 43 // Called when a panel's expansion state changes. |
42 void OnPanelExpansionStateChanged(Panel* panel); | 44 void OnPanelExpansionStateChanged(Panel* panel); |
43 | 45 |
44 // Called when a panel is starting/stopping drawing an attention. | |
45 void OnPanelAttentionStateChanged(Panel* panel); | |
46 | |
47 // Refreshes the layouts for all panels to reflect any possible changes. | |
48 void Refresh(); | |
49 | |
50 void OnFullScreenModeChanged(bool is_full_screen); | 46 void OnFullScreenModeChanged(bool is_full_screen); |
51 | 47 |
52 int num_panels() const { return static_cast<int>(panels_.size()); } | 48 int num_panels() const { return static_cast<int>(panels_.size()); } |
53 Panel* first_panel() const { | 49 Panel* first_panel() const { |
54 return panels_.empty() ? NULL : panels_.front(); | 50 return panels_.empty() ? NULL : panels_.front(); |
55 } | 51 } |
56 const Panels& panels() const { return panels_; } | 52 const Panels& panels() const { return panels_; } |
57 | 53 |
58 #ifdef UNIT_TEST | 54 #ifdef UNIT_TEST |
59 int current_display_width() const { return current_display_width_; } | 55 int current_display_width() const { return current_display_width_; } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 int overflow_hover_animator_start_width_; | 136 int overflow_hover_animator_start_width_; |
141 int overflow_hover_animator_end_width_; | 137 int overflow_hover_animator_end_width_; |
142 | 138 |
143 // Invalid panel index. | 139 // Invalid panel index. |
144 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); | 140 static const size_t kInvalidPanelIndex = static_cast<size_t>(-1); |
145 | 141 |
146 DISALLOW_COPY_AND_ASSIGN(OverflowPanelStrip); | 142 DISALLOW_COPY_AND_ASSIGN(OverflowPanelStrip); |
147 }; | 143 }; |
148 | 144 |
149 #endif // CHROME_BROWSER_UI_PANELS_OVERFLOW_PANEL_STRIP_H_ | 145 #endif // CHROME_BROWSER_UI_PANELS_OVERFLOW_PANEL_STRIP_H_ |
OLD | NEW |