| 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_STACKED_PANEL_COLLECTION_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_STACKED_PANEL_COLLECTION_H_ |
| 6 #define CHROME_BROWSER_UI_PANELS_STACKED_PANEL_COLLECTION_H_ | 6 #define CHROME_BROWSER_UI_PANELS_STACKED_PANEL_COLLECTION_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "chrome/browser/ui/panels/native_panel_stack_window.h" | 11 #include "chrome/browser/ui/panels/native_panel_stack_window.h" |
| 12 #include "chrome/browser/ui/panels/panel_collection.h" | 12 #include "chrome/browser/ui/panels/panel_collection.h" |
| 13 #include "chrome/browser/ui/panels/panel_constants.h" | 13 #include "chrome/browser/ui/panels/panel_constants.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 | 15 |
| 16 class PanelManager; | 16 class PanelManager; |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Vector2d; | 18 class Vector2d; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class StackedPanelCollection : public PanelCollection, | 21 class StackedPanelCollection : public PanelCollection, |
| 22 public NativePanelStackWindowDelegate { | 22 public NativePanelStackWindowDelegate { |
| 23 public: | 23 public: |
| 24 typedef std::list<Panel*> Panels; | 24 typedef std::list<Panel*> Panels; |
| 25 | 25 |
| 26 explicit StackedPanelCollection(PanelManager* panel_manager); | 26 explicit StackedPanelCollection(PanelManager* panel_manager); |
| 27 virtual ~StackedPanelCollection(); | 27 ~StackedPanelCollection() override; |
| 28 | 28 |
| 29 // PanelCollection OVERRIDES: | 29 // PanelCollection OVERRIDES: |
| 30 virtual void OnDisplayChanged() override; | 30 void OnDisplayChanged() override; |
| 31 virtual void RefreshLayout() override; | 31 void RefreshLayout() override; |
| 32 virtual void AddPanel(Panel* panel, | 32 void AddPanel(Panel* panel, PositioningMask positioning_mask) override; |
| 33 PositioningMask positioning_mask) override; | 33 void RemovePanel(Panel* panel, RemovalReason reason) override; |
| 34 virtual void RemovePanel(Panel* panel, RemovalReason reason) override; | 34 void CloseAll() override; |
| 35 virtual void CloseAll() override; | 35 void ResizePanelWindow(Panel* panel, |
| 36 virtual void ResizePanelWindow( | 36 const gfx::Size& preferred_window_size) override; |
| 37 Panel* panel, | 37 panel::Resizability GetPanelResizability(const Panel* panel) const override; |
| 38 const gfx::Size& preferred_window_size) override; | 38 void OnPanelResizedByMouse(Panel* panel, |
| 39 virtual panel::Resizability GetPanelResizability( | 39 const gfx::Rect& new_bounds) override; |
| 40 const Panel* panel) const override; | 40 void OnPanelAttentionStateChanged(Panel* panel) override; |
| 41 virtual void OnPanelResizedByMouse(Panel* panel, | 41 void OnPanelTitlebarClicked(Panel* panel, |
| 42 const gfx::Rect& new_bounds) override; | 42 panel::ClickModifier modifier) override; |
| 43 virtual void OnPanelAttentionStateChanged(Panel* panel) override; | 43 void ActivatePanel(Panel* panel) override; |
| 44 virtual void OnPanelTitlebarClicked(Panel* panel, | 44 void MinimizePanel(Panel* panel) override; |
| 45 panel::ClickModifier modifier) override; | 45 void RestorePanel(Panel* panel) override; |
| 46 virtual void ActivatePanel(Panel* panel) override; | 46 void OnMinimizeButtonClicked(Panel* panel, |
| 47 virtual void MinimizePanel(Panel* panel) override; | 47 panel::ClickModifier modifier) override; |
| 48 virtual void RestorePanel(Panel* panel) override; | 48 void OnRestoreButtonClicked(Panel* panel, |
| 49 virtual void OnMinimizeButtonClicked(Panel* panel, | 49 panel::ClickModifier modifier) override; |
| 50 panel::ClickModifier modifier) override; | 50 bool CanShowMinimizeButton(const Panel* panel) const override; |
| 51 virtual void OnRestoreButtonClicked(Panel* panel, | 51 bool CanShowRestoreButton(const Panel* panel) const override; |
| 52 panel::ClickModifier modifier) override; | 52 bool IsPanelMinimized(const Panel* panel) const override; |
| 53 virtual bool CanShowMinimizeButton(const Panel* panel) const override; | 53 bool UsesAlwaysOnTopPanels() const override; |
| 54 virtual bool CanShowRestoreButton(const Panel* panel) const override; | 54 void SavePanelPlacement(Panel* panel) override; |
| 55 virtual bool IsPanelMinimized(const Panel* panel) const override; | 55 void RestorePanelToSavedPlacement() override; |
| 56 virtual bool UsesAlwaysOnTopPanels() const override; | 56 void DiscardSavedPanelPlacement() override; |
| 57 virtual void SavePanelPlacement(Panel* panel) override; | 57 void UpdatePanelOnCollectionChange(Panel* panel) override; |
| 58 virtual void RestorePanelToSavedPlacement() override; | 58 void OnPanelExpansionStateChanged(Panel* panel) override; |
| 59 virtual void DiscardSavedPanelPlacement() override; | 59 void OnPanelActiveStateChanged(Panel* panel) override; |
| 60 virtual void UpdatePanelOnCollectionChange(Panel* panel) override; | 60 gfx::Rect GetInitialPanelBounds( |
| 61 virtual void OnPanelExpansionStateChanged(Panel* panel) override; | |
| 62 virtual void OnPanelActiveStateChanged(Panel* panel) override; | |
| 63 virtual gfx::Rect GetInitialPanelBounds( | |
| 64 const gfx::Rect& requested_bounds) const override; | 61 const gfx::Rect& requested_bounds) const override; |
| 65 | 62 |
| 66 Panel* GetPanelAbove(Panel* panel) const; | 63 Panel* GetPanelAbove(Panel* panel) const; |
| 67 Panel* GetPanelBelow(Panel* panel) const; | 64 Panel* GetPanelBelow(Panel* panel) const; |
| 68 bool HasPanel(Panel* panel) const; | 65 bool HasPanel(Panel* panel) const; |
| 69 | 66 |
| 70 void MoveAllDraggingPanelsInstantly(const gfx::Vector2d& delta_origin); | 67 void MoveAllDraggingPanelsInstantly(const gfx::Vector2d& delta_origin); |
| 71 | 68 |
| 72 bool IsMinimized() const; | 69 bool IsMinimized() const; |
| 73 bool IsAnimatingPanelBounds(Panel* panel) const; | 70 bool IsAnimatingPanelBounds(Panel* panel) const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 97 // restoring it. When there're only 2 panels in the stack and the bottom | 94 // restoring it. When there're only 2 panels in the stack and the bottom |
| 98 // panel is being dragged out of the stack, both panels will be moved to | 95 // panel is being dragged out of the stack, both panels will be moved to |
| 99 // the detached collection. We need to track the top panel in order to | 96 // the detached collection. We need to track the top panel in order to |
| 100 // put it back to the same stack of the dragging panel. | 97 // put it back to the same stack of the dragging panel. |
| 101 Panel* top_panel; | 98 Panel* top_panel; |
| 102 | 99 |
| 103 PanelPlacement() : panel(NULL), top_panel(NULL) { } | 100 PanelPlacement() : panel(NULL), top_panel(NULL) { } |
| 104 }; | 101 }; |
| 105 | 102 |
| 106 // Overridden from PanelBoundsBatchUpdateObserver: | 103 // Overridden from PanelBoundsBatchUpdateObserver: |
| 107 virtual base::string16 GetTitle() const override; | 104 base::string16 GetTitle() const override; |
| 108 virtual gfx::Image GetIcon() const override; | 105 gfx::Image GetIcon() const override; |
| 109 virtual void PanelBoundsBatchUpdateCompleted() override; | 106 void PanelBoundsBatchUpdateCompleted() override; |
| 110 | 107 |
| 111 // Returns the enclosing bounds that include all panels in the stack. | 108 // Returns the enclosing bounds that include all panels in the stack. |
| 112 gfx::Rect GetEnclosingBounds() const; | 109 gfx::Rect GetEnclosingBounds() const; |
| 113 | 110 |
| 114 // Returns the work area where the stack resides. If the stack spans across | 111 // Returns the work area where the stack resides. If the stack spans across |
| 115 // multiple displays, return the work area of the display that most closely | 112 // multiple displays, return the work area of the display that most closely |
| 116 // intersects the stack. | 113 // intersects the stack. |
| 117 gfx::Rect GetWorkArea() const; | 114 gfx::Rect GetWorkArea() const; |
| 118 | 115 |
| 119 // Refresh all panel layouts, with top panel poisitoned at |start_position|. | 116 // Refresh all panel layouts, with top panel poisitoned at |start_position|. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 170 |
| 174 // Used to save the placement information for a panel. | 171 // Used to save the placement information for a panel. |
| 175 PanelPlacement saved_panel_placement_; | 172 PanelPlacement saved_panel_placement_; |
| 176 | 173 |
| 177 bool minimizing_all_; // True while minimizing all panels. | 174 bool minimizing_all_; // True while minimizing all panels. |
| 178 | 175 |
| 179 DISALLOW_COPY_AND_ASSIGN(StackedPanelCollection); | 176 DISALLOW_COPY_AND_ASSIGN(StackedPanelCollection); |
| 180 }; | 177 }; |
| 181 | 178 |
| 182 #endif // CHROME_BROWSER_UI_PANELS_STACKED_PANEL_COLLECTION_H_ | 179 #endif // CHROME_BROWSER_UI_PANELS_STACKED_PANEL_COLLECTION_H_ |
| OLD | NEW |