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/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 10 |
11 class Panel; | 11 class Panel; |
12 | 12 |
13 // Common base class for a collection of panels. Subclasses manage | 13 // Common base class for a collection of panels. Subclasses manage |
14 // various layouts for displaying panels in the collection. | 14 // various layouts for displaying panels in the collection. |
15 class PanelStrip { | 15 class PanelStrip { |
16 public: | 16 public: |
17 // Types of layout for the panel collections. | 17 // Types of layout for the panel collections. |
18 enum Type { | 18 enum Type { |
19 DETACHED, // free-floating panels | 19 DETACHED, // free-floating panels |
20 DOCKED, // panels are 'docked' along the window's edge | 20 DOCKED, // panels are 'docked' along the window's edge |
21 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area | 21 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area |
22 }; | 22 }; |
23 | 23 |
| 24 enum AutoResizeState { |
| 25 AUTORESIZE_ENABLED, |
| 26 AUTORESIZE_DISABLED, |
| 27 }; |
| 28 |
24 Type type() const { return type_; } | 29 Type type() const { return type_; } |
25 | 30 |
26 // Sets the bounds of the panel strip. | 31 // Sets the bounds of the panel strip. |
27 // |display_area| is in screen coordinates. | 32 // |display_area| is in screen coordinates. |
28 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; | 33 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; |
29 | 34 |
30 // Updates the positioning of all panels in the collection, usually as | 35 // Updates the positioning of all panels in the collection, usually as |
31 // a result of removing or resizing a panel in collection. | 36 // a result of removing or resizing a panel in collection. |
32 virtual void RefreshLayout() = 0; | 37 virtual void RefreshLayout() = 0; |
33 | 38 |
34 // Adds |panel| to the collection of panels. | 39 // Adds |panel| to the collection of panels. |
35 virtual void AddPanel(Panel* panel) = 0; | 40 virtual void AddPanel(Panel* panel) = 0; |
36 | 41 |
37 // Removes |panel| from the collection of panels. Invoked asynchronously | 42 // Removes |panel| from the collection of panels. Invoked asynchronously |
38 // after a panel has been closed. | 43 // after a panel has been closed. |
39 // Returns |false| if the panel is not in the strip. | 44 // Returns |false| if the panel is not in the strip. |
40 virtual bool RemovePanel(Panel* panel) = 0; | 45 virtual bool RemovePanel(Panel* panel) = 0; |
41 | 46 |
42 // Closes all panels in the collection. Panels will be removed after closing. | 47 // Closes all panels in the collection. Panels will be removed after closing. |
43 virtual void CloseAll() = 0; | 48 virtual void CloseAll() = 0; |
44 | 49 |
45 // Resizes the |panel| to the |preferred_window_size| and updates the layout | 50 // Resizes the |panel| to the |preferred_window_size| and updates the layout |
46 // of other panels in the collection accordingly. | 51 // of other panels in the collection accordingly. |
47 // |preferred_window_size| is the outer dimensions of the window, not | 52 // |preferred_window_size| is the outer dimensions of the window, not |
48 // the content area, and is in screen coordinates. | 53 // the content area, and is in screen coordinates. |
49 // The preferred size may be adjusted to fit layout constraints. | 54 // The preferred size may be adjusted to fit layout constraints. |
50 virtual void ResizePanelWindow(Panel* panel, | 55 virtual void ResizePanelWindow(Panel* panel, |
51 const gfx::Size& preferred_window_size) = 0; | 56 const gfx::Size& preferred_window_size, |
| 57 AutoResizeState auto_resize_state) = 0; |
52 | 58 |
53 // Invoked when the draw attention state of the panel has changed. | 59 // Invoked when the draw attention state of the panel has changed. |
54 // Subclass should update the display of the panel to match the new | 60 // Subclass should update the display of the panel to match the new |
55 // draw attention state. | 61 // draw attention state. |
56 virtual void OnPanelAttentionStateChanged(Panel* panel) = 0; | 62 virtual void OnPanelAttentionStateChanged(Panel* panel) = 0; |
57 | 63 |
58 // Updates the display to show |panel| as active. | 64 // Updates the display to show |panel| as active. |
59 virtual void ActivatePanel(Panel* panel) = 0; | 65 virtual void ActivatePanel(Panel* panel) = 0; |
60 | 66 |
61 // Updates the display to show |panel| as minimized/restored. | 67 // Updates the display to show |panel| as minimized/restored. |
(...skipping 14 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 |