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/rect.h" | 14 #include "ui/gfx/rect.h" |
14 | 15 |
15 class Browser; | 16 class Browser; |
16 class PanelManager; | 17 class PanelManager; |
17 | 18 |
18 // This class manages a group of free-floating panels. | 19 // This class manages a group of free-floating panels. |
19 class DetachedPanelStrip : public PanelStrip { | 20 class DetachedPanelStrip : public PanelStrip { |
20 public: | 21 public: |
21 typedef std::set<Panel*> Panels; | 22 typedef std::set<Panel*> Panels; |
22 | 23 |
23 explicit DetachedPanelStrip(PanelManager* panel_manager); | 24 explicit DetachedPanelStrip(PanelManager* panel_manager); |
24 virtual ~DetachedPanelStrip(); | 25 virtual ~DetachedPanelStrip(); |
25 | 26 |
26 // PanelStrip OVERRIDES: | 27 // PanelStrip OVERRIDES: |
27 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; | 28 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; |
28 virtual void RefreshLayout() OVERRIDE; | 29 virtual void RefreshLayout() OVERRIDE; |
29 virtual void AddPanel(Panel* panel) OVERRIDE; | 30 virtual void AddPanel(Panel* panel) OVERRIDE; |
30 virtual bool RemovePanel(Panel* panel) OVERRIDE; | 31 virtual bool RemovePanel(Panel* panel) OVERRIDE; |
31 virtual void CloseAll() OVERRIDE; | 32 virtual void CloseAll() OVERRIDE; |
32 virtual void ResizePanelWindow( | 33 virtual void ResizePanelWindow( |
33 Panel* panel, | 34 Panel* panel, |
34 const gfx::Size& preferred_window_size) OVERRIDE; | 35 const gfx::Size& preferred_window_size) OVERRIDE; |
35 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; | 36 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; |
36 virtual void ActivatePanel(Panel* panel) OVERRIDE; | 37 virtual void ActivatePanel(Panel* panel) OVERRIDE; |
37 virtual void MinimizePanel(Panel* panel) OVERRIDE; | 38 virtual void MinimizePanel(Panel* panel) OVERRIDE; |
38 virtual void RestorePanel(Panel* panel) OVERRIDE; | 39 virtual void RestorePanel(Panel* panel) OVERRIDE; |
40 virtual bool CanDragPanel(Panel* panel) const OVERRIDE; | |
41 virtual void StartDraggingPanel(Panel* panel) OVERRIDE; | |
42 virtual void DragPanel(int delta_x, int delta_y) OVERRIDE; | |
43 virtual void EndDraggingPanel(bool cancelled) OVERRIDE; | |
39 | 44 |
40 int num_panels() const { return panels_.size(); } | 45 int num_panels() const { return panels_.size(); } |
41 const Panels& panels() const { return panels_; } | 46 const Panels& panels() const { return panels_; } |
42 | 47 |
43 private: | 48 private: |
44 PanelManager* panel_manager_; // Weak, owns us. | 49 PanelManager* panel_manager_; // Weak, owns us. |
45 | 50 |
46 // All panels in the panel strip must fit within this area. | 51 // All panels in the panel strip must fit within this area. |
47 gfx::Rect display_area_; | 52 gfx::Rect display_area_; |
48 | 53 |
49 // Collection of all panels. | 54 // Collection of all panels. |
50 Panels panels_; | 55 Panels panels_; |
51 | 56 |
57 // Panel being dragged. | |
58 Panel* dragging_panel_; | |
jennb
2012/02/16 22:31:00
This is already tracked in drag controller. Do we
jianli
2012/02/16 23:05:52
They're served for different purpose. PanelDragCon
| |
59 | |
60 // Original position of the panel being dragged. This is used to get back to | |
61 // the original position when we cancel the dragging. | |
62 gfx::Point dragging_panel_original_position_; | |
jennb
2012/02/16 22:31:00
What is position? the x,y coordinates of the panel
jianli
2012/02/16 23:05:52
The origin (x, y coordinates) of the panel's bound
| |
63 | |
52 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip); | 64 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip); |
53 }; | 65 }; |
54 | 66 |
55 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ | 67 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ |
OLD | NEW |