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_PANEL_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ui/gfx/point.h" | |
9 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
10 | 11 |
11 class Panel; | 12 class Panel; |
12 | 13 |
13 // Common base class for a collection of panels. Subclasses manage | 14 // Common base class for a collection of panels. Subclasses manage |
14 // various layouts for displaying panels in the collection. | 15 // various layouts for displaying panels in the collection. |
15 class PanelStrip { | 16 class PanelStrip { |
16 public: | 17 public: |
17 // Types of layout for the panel collections. | 18 // Types of layout for the panel collections. |
18 enum Type { | 19 enum Type { |
19 DETACHED, // free-floating panels | 20 DETACHED, // free-floating panels |
20 DOCKED, // panels are 'docked' along the window's edge | 21 DOCKED, // panels are 'docked' along the window's edge |
21 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area | 22 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area |
22 }; | 23 }; |
23 | 24 |
24 Type type() const { return type_; } | 25 Type type() const { return type_; } |
25 | 26 |
26 // Sets the bounds of the panel strip. | 27 // Sets the bounds of the panel strip. |
27 // |display_area| is in screen coordinates. | 28 // |display_area| is in screen coordinates. |
28 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; | 29 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; |
29 | 30 |
30 // Updates the positioning of all panels in the collection, usually as | 31 // Updates the positioning of all panels in the collection, usually as |
31 // a result of removing or resizing a panel in collection. | 32 // a result of removing or resizing a panel in collection. |
32 virtual void RefreshLayout() = 0; | 33 virtual void RefreshLayout() = 0; |
33 | 34 |
34 // Adds |panel| to the collection of panels. | 35 // Adds |panel| to the collection of panels. |
35 virtual void AddPanel(Panel* panel) = 0; | 36 virtual void AddPanel(Panel* panel) = 0; |
36 | 37 |
38 // Adds |panel| to the collection of panels and positions it at or close to | |
39 // |position| that is in screen coordinates. It is up to the strip itself to | |
40 // decide the final position that the panel can be. | |
41 virtual void AddPanelAtPosition(Panel* panel, const gfx::Point& position) = 0; | |
jennb
2012/03/01 00:33:38
Is the origin of the panel placed close to |positi
jianli
2012/03/02 22:42:43
Renamed this method to AddDraggingPanel to mean it
| |
42 | |
37 // Removes |panel| from the collection of panels. Invoked asynchronously | 43 // Removes |panel| from the collection of panels. Invoked asynchronously |
38 // after a panel has been closed. | 44 // after a panel has been closed. |
39 // Returns |false| if the panel is not in the strip. | 45 // Returns |false| if the panel is not in the strip. |
40 virtual bool RemovePanel(Panel* panel) = 0; | 46 virtual bool RemovePanel(Panel* panel) = 0; |
41 | 47 |
42 // Closes all panels in the collection. Panels will be removed after closing. | 48 // Closes all panels in the collection. Panels will be removed after closing. |
43 virtual void CloseAll() = 0; | 49 virtual void CloseAll() = 0; |
44 | 50 |
45 // Resizes the |panel| to the |preferred_window_size| and updates the layout | 51 // Resizes the |panel| to the |preferred_window_size| and updates the layout |
46 // of other panels in the collection accordingly. | 52 // of other panels in the collection accordingly. |
(...skipping 29 matching lines...) Expand all Loading... | |
76 virtual void EndDraggingPanel(Panel* panel, bool cancelled) = 0; | 82 virtual void EndDraggingPanel(Panel* panel, bool cancelled) = 0; |
77 | 83 |
78 protected: | 84 protected: |
79 explicit PanelStrip(Type type); | 85 explicit PanelStrip(Type type); |
80 virtual ~PanelStrip(); | 86 virtual ~PanelStrip(); |
81 | 87 |
82 const Type type_; // Type of this panel strip. | 88 const Type type_; // Type of this panel strip. |
83 }; | 89 }; |
84 | 90 |
85 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ | 91 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
OLD | NEW |