| 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_DETACHED_PANEL_COLLECTION_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_COLLECTION_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_COLLECTION_H_ | 6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_COLLECTION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/ui/panels/panel.h" | 10 #include "chrome/browser/ui/panels/panel.h" |
| 11 #include "chrome/browser/ui/panels/panel_collection.h" | 11 #include "chrome/browser/ui/panels/panel_collection.h" |
| 12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 class PanelManager; | 15 class PanelManager; |
| 16 | 16 |
| 17 // This class manages a group of free-floating panels. | 17 // This class manages a group of free-floating panels. |
| 18 class DetachedPanelCollection : public PanelCollection { | 18 class DetachedPanelCollection : public PanelCollection { |
| 19 public: | 19 public: |
| 20 typedef std::list<Panel*> Panels; | 20 typedef std::list<Panel*> Panels; |
| 21 typedef bool (*PanelsComparer)(Panel* panel1, Panel* panel2); | 21 typedef bool (*PanelsComparer)(Panel* panel1, Panel* panel2); |
| 22 | 22 |
| 23 explicit DetachedPanelCollection(PanelManager* panel_manager); | 23 explicit DetachedPanelCollection(PanelManager* panel_manager); |
| 24 virtual ~DetachedPanelCollection(); | 24 ~DetachedPanelCollection() override; |
| 25 | 25 |
| 26 // PanelCollection OVERRIDES: | 26 // PanelCollection OVERRIDES: |
| 27 virtual void OnDisplayChanged() override; | 27 void OnDisplayChanged() override; |
| 28 virtual void RefreshLayout() override; | 28 void RefreshLayout() override; |
| 29 virtual void AddPanel(Panel* panel, | 29 void AddPanel(Panel* panel, PositioningMask positioning_mask) override; |
| 30 PositioningMask positioning_mask) override; | 30 void RemovePanel(Panel* panel, RemovalReason reason) override; |
| 31 virtual void RemovePanel(Panel* panel, RemovalReason reason) override; | 31 void CloseAll() override; |
| 32 virtual void CloseAll() override; | 32 void ResizePanelWindow(Panel* panel, |
| 33 virtual void ResizePanelWindow( | 33 const gfx::Size& preferred_window_size) override; |
| 34 Panel* panel, | 34 panel::Resizability GetPanelResizability(const Panel* panel) const override; |
| 35 const gfx::Size& preferred_window_size) override; | 35 void OnPanelResizedByMouse(Panel* panel, |
| 36 virtual panel::Resizability GetPanelResizability( | 36 const gfx::Rect& new_bounds) override; |
| 37 const Panel* panel) const override; | 37 void OnPanelAttentionStateChanged(Panel* panel) override; |
| 38 virtual void OnPanelResizedByMouse(Panel* panel, | 38 void OnPanelTitlebarClicked(Panel* panel, |
| 39 const gfx::Rect& new_bounds) override; | 39 panel::ClickModifier modifier) override; |
| 40 virtual void OnPanelAttentionStateChanged(Panel* panel) override; | 40 void ActivatePanel(Panel* panel) override; |
| 41 virtual void OnPanelTitlebarClicked(Panel* panel, | 41 void MinimizePanel(Panel* panel) override; |
| 42 panel::ClickModifier modifier) override; | 42 void RestorePanel(Panel* panel) override; |
| 43 virtual void ActivatePanel(Panel* panel) override; | 43 void OnMinimizeButtonClicked(Panel* panel, |
| 44 virtual void MinimizePanel(Panel* panel) override; | 44 panel::ClickModifier modifier) override; |
| 45 virtual void RestorePanel(Panel* panel) override; | 45 void OnRestoreButtonClicked(Panel* panel, |
| 46 virtual void OnMinimizeButtonClicked(Panel* panel, | 46 panel::ClickModifier modifier) override; |
| 47 panel::ClickModifier modifier) override; | 47 bool CanShowMinimizeButton(const Panel* panel) const override; |
| 48 virtual void OnRestoreButtonClicked(Panel* panel, | 48 bool CanShowRestoreButton(const Panel* panel) const override; |
| 49 panel::ClickModifier modifier) override; | 49 bool IsPanelMinimized(const Panel* panel) const override; |
| 50 virtual bool CanShowMinimizeButton(const Panel* panel) const override; | 50 bool UsesAlwaysOnTopPanels() const override; |
| 51 virtual bool CanShowRestoreButton(const Panel* panel) const override; | 51 void SavePanelPlacement(Panel* panel) override; |
| 52 virtual bool IsPanelMinimized(const Panel* panel) const override; | 52 void RestorePanelToSavedPlacement() override; |
| 53 virtual bool UsesAlwaysOnTopPanels() const override; | 53 void DiscardSavedPanelPlacement() override; |
| 54 virtual void SavePanelPlacement(Panel* panel) override; | 54 void UpdatePanelOnCollectionChange(Panel* panel) override; |
| 55 virtual void RestorePanelToSavedPlacement() override; | 55 void OnPanelExpansionStateChanged(Panel* panel) override; |
| 56 virtual void DiscardSavedPanelPlacement() override; | 56 void OnPanelActiveStateChanged(Panel* panel) override; |
| 57 virtual void UpdatePanelOnCollectionChange(Panel* panel) override; | 57 gfx::Rect GetInitialPanelBounds( |
| 58 virtual void OnPanelExpansionStateChanged(Panel* panel) override; | |
| 59 virtual void OnPanelActiveStateChanged(Panel* panel) override; | |
| 60 virtual gfx::Rect GetInitialPanelBounds( | |
| 61 const gfx::Rect& requested_bounds) const override; | 58 const gfx::Rect& requested_bounds) const override; |
| 62 | 59 |
| 63 bool HasPanel(Panel* panel) const; | 60 bool HasPanel(Panel* panel) const; |
| 64 | 61 |
| 65 void SortPanels(PanelsComparer comparer); | 62 void SortPanels(PanelsComparer comparer); |
| 66 | 63 |
| 67 int num_panels() const { return panels_.size(); } | 64 int num_panels() const { return panels_.size(); } |
| 68 const Panels& panels() const { return panels_; } | 65 const Panels& panels() const { return panels_; } |
| 69 | 66 |
| 70 // Returns default top-left to use for a detached panel whose position is | 67 // Returns default top-left to use for a detached panel whose position is |
| (...skipping 21 matching lines...) Expand all Loading... |
| 92 PanelPlacement saved_panel_placement_; | 89 PanelPlacement saved_panel_placement_; |
| 93 | 90 |
| 94 // Default top-left position to use for next detached panel if position is | 91 // Default top-left position to use for next detached panel if position is |
| 95 // unspecified by panel creator. | 92 // unspecified by panel creator. |
| 96 gfx::Point default_panel_origin_; | 93 gfx::Point default_panel_origin_; |
| 97 | 94 |
| 98 DISALLOW_COPY_AND_ASSIGN(DetachedPanelCollection); | 95 DISALLOW_COPY_AND_ASSIGN(DetachedPanelCollection); |
| 99 }; | 96 }; |
| 100 | 97 |
| 101 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_COLLECTION_H_ | 98 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_COLLECTION_H_ |
| OLD | NEW |