Index: chrome/browser/ui/panels/panel_strip.h |
diff --git a/chrome/browser/ui/panels/panel_strip.h b/chrome/browser/ui/panels/panel_strip.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..59f50e6d9aef92ae7c0a4f3388db555a5ae26f2d |
--- /dev/null |
+++ b/chrome/browser/ui/panels/panel_strip.h |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
+#define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |
+#pragma once |
+ |
+#include "ui/gfx/rect.h" |
+ |
+class Panel; |
+ |
+// Common base class for a collection of panels. Subclasses manage |
+// various layouts for displaying panels in the collection. |
+class PanelStrip { |
+ public: |
+ // Types of layout for the panel collections. |
+ enum Type { |
+ DETACHED, // free-floating panels |
+ DOCKED, // panels are 'docked' along the window's edge |
+ IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area |
+ }; |
+ |
+ Type type() const { return type_; } |
+ |
+ // Sets the bounds of the panel strip. |
+ // |display_area| is in screen coordinates. |
+ virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; |
+ |
+ // Updates the positioning of all panels in the collection, usually as |
+ // a result of removing or resizing a panel in collection. |
+ virtual void RefreshLayout() = 0; |
+ |
+ // Adds |panel| to the collection of panels. |
+ virtual void AddPanel(Panel* panel) = 0; |
+ |
+ // Removes |panel| from the collection of panels. Invoked asynchronously |
+ // after a panel has been closed. |
+ // Returns |false| if the panel is not in the strip. |
+ virtual bool RemovePanel(Panel* panel) = 0; |
+ |
+ // Closes all panels in the collection. Panels will be removed after closing. |
+ virtual void CloseAll() = 0; |
+ |
+ // Resizes the |panel| to the |preferred_window_size|. |
+ // The preferred size may be adjusted to fit layout constraints. |
+ virtual void ResizePanelWindow(Panel* panel, |
+ const gfx::Size& preferred_window_size) = 0; |
Dmitry Titov
2012/02/07 00:46:46
Could you add a comment to reflect which coord sys
jennb
2012/02/07 01:06:09
Done.
|
+ |
+ // Starts dragging the |panel|. |
+ virtual void StartDragging(Panel* panel) = 0; |
Dmitry Titov
2012/02/07 00:46:46
Is this a temporary thing? We discussed this to be
jennb
2012/02/07 01:06:09
Removed from base class.
|
+ |
+ // Updates the drag position of the panel currently being dragged. |
+ // |delta_x| and |delta_y| is the change from the initial mouse position |
+ // at the start of the drag. |
+ virtual void Drag(int delta_x, int delta_y) = 0; |
+ |
+ // Completes the current drag. |
+ // |cancelled| is true if the drag was cancelled. |
+ virtual void EndDragging(bool cancelled) = 0; |
+ |
+ // Invoked when the draw attention state of the panel has changed. |
+ // Subclass should update the display of the panel to match the new |
+ // draw attention state. |
+ virtual void OnPanelAttentionStateChanged(Panel* panel) = 0; |
+ |
+ protected: |
+ explicit PanelStrip(Type type); |
+ ~PanelStrip(); |
Dmitry Titov
2012/02/07 00:46:46
~ should be virtual
jennb
2012/02/07 01:06:09
Done.
|
+ |
+ Type type_; // Type of this panel strip. |
Dmitry Titov
2012/02/07 00:46:46
should it be 'const'?
jennb
2012/02/07 01:06:09
Done.
|
+}; |
+ |
+#endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ |