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