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_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ |
6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "chrome/browser/ui/panels/panel.h" | 11 #include "chrome/browser/ui/panels/panel.h" |
12 #include "chrome/browser/ui/panels/panel_strip.h" | 12 #include "chrome/browser/ui/panels/panel_strip.h" |
13 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 | 15 |
16 class Browser; | 16 class Browser; |
17 class PanelManager; | 17 class PanelManager; |
18 | 18 |
19 // This class manages a group of free-floating panels. | 19 // This class manages a group of free-floating panels. |
20 class DetachedPanelStrip : public PanelStrip { | 20 class DetachedPanelStrip : public PanelStrip { |
21 public: | 21 public: |
22 typedef std::set<Panel*> Panels; | 22 typedef std::set<Panel*> Panels; |
23 | 23 |
24 explicit DetachedPanelStrip(PanelManager* panel_manager); | 24 explicit DetachedPanelStrip(PanelManager* panel_manager); |
25 virtual ~DetachedPanelStrip(); | 25 virtual ~DetachedPanelStrip(); |
26 | 26 |
27 // PanelStrip OVERRIDES: | 27 // PanelStrip OVERRIDES: |
28 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; | 28 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; |
29 virtual void RefreshLayout() OVERRIDE; | 29 virtual void RefreshLayout() OVERRIDE; |
30 virtual void AddPanel(Panel* panel) OVERRIDE; | 30 virtual void AddPanel(Panel* panel, |
| 31 PositioningMask positioning_mask) OVERRIDE; |
31 virtual void RemovePanel(Panel* panel) OVERRIDE; | 32 virtual void RemovePanel(Panel* panel) OVERRIDE; |
32 virtual void CloseAll() OVERRIDE; | 33 virtual void CloseAll() OVERRIDE; |
33 virtual void ResizePanelWindow( | 34 virtual void ResizePanelWindow( |
34 Panel* panel, | 35 Panel* panel, |
35 const gfx::Size& preferred_window_size) OVERRIDE; | 36 const gfx::Size& preferred_window_size) OVERRIDE; |
36 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; | 37 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
37 virtual void ActivatePanel(Panel* panel) OVERRIDE; | 38 virtual void ActivatePanel(Panel* panel) OVERRIDE; |
38 virtual void MinimizePanel(Panel* panel) OVERRIDE; | 39 virtual void MinimizePanel(Panel* panel) OVERRIDE; |
39 virtual void RestorePanel(Panel* panel) OVERRIDE; | 40 virtual void RestorePanel(Panel* panel) OVERRIDE; |
40 virtual bool IsPanelMinimized(const Panel* panel) const OVERRIDE; | 41 virtual bool IsPanelMinimized(const Panel* panel) const OVERRIDE; |
41 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; | 42 virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE; |
| 43 virtual void SavePanelPlacement(Panel* panel) OVERRIDE; |
| 44 virtual void RestorePanelToSavedPlacement() OVERRIDE; |
| 45 virtual void DiscardSavedPanelPlacement() OVERRIDE; |
42 virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; | 46 virtual bool CanDragPanel(const Panel* panel) const OVERRIDE; |
43 virtual void StartDraggingPanel(Panel* panel) OVERRIDE; | 47 virtual void StartDraggingPanelWithinStrip(Panel* panel) OVERRIDE; |
44 virtual void DragPanel(Panel* panel, int delta_x, int delta_y) OVERRIDE; | 48 virtual void DragPanelWithinStrip(Panel* panel, |
45 virtual void EndDraggingPanel(Panel* panel, bool cancelled) OVERRIDE; | 49 int delta_x, |
| 50 int delta_y) OVERRIDE; |
| 51 virtual void EndDraggingPanelWithinStrip(Panel* panel, |
| 52 bool aborted) OVERRIDE; |
46 | 53 |
47 bool HasPanel(Panel* panel) const; | 54 bool HasPanel(Panel* panel) const; |
48 | 55 |
49 int num_panels() const { return panels_.size(); } | 56 int num_panels() const { return panels_.size(); } |
50 const Panels& panels() const { return panels_; } | 57 const Panels& panels() const { return panels_; } |
51 | 58 |
52 private: | 59 private: |
| 60 struct PanelPlacement { |
| 61 Panel* panel; |
| 62 gfx::Point position; |
| 63 |
| 64 PanelPlacement() : panel(NULL) { } |
| 65 }; |
| 66 |
53 PanelManager* panel_manager_; // Weak, owns us. | 67 PanelManager* panel_manager_; // Weak, owns us. |
54 | 68 |
55 // All panels in the panel strip must fit within this area. | 69 // All panels in the panel strip must fit within this area. |
56 gfx::Rect display_area_; | 70 gfx::Rect display_area_; |
57 | 71 |
58 // Collection of all panels. | 72 // Collection of all panels. |
59 Panels panels_; | 73 Panels panels_; |
60 | 74 |
| 75 // Used to save the placement information for a panel. |
| 76 PanelPlacement saved_panel_placement_; |
| 77 |
61 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip); | 78 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip); |
62 }; | 79 }; |
63 | 80 |
64 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ | 81 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ |
OLD | NEW |