Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: chrome/browser/ui/panels/docked_panel_strip.h

Issue 9546001: Support detaching/attaching panels via inter-strip drags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fix per feedback Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/docked_panel_strip.h
diff --git a/chrome/browser/ui/panels/docked_panel_strip.h b/chrome/browser/ui/panels/docked_panel_strip.h
index 89cf565e758141e97571670e2c7f225292a59aff..18cb8ab309421df313ec1398d3e8f8a12ab17ca6 100644
--- a/chrome/browser/ui/panels/docked_panel_strip.h
+++ b/chrome/browser/ui/panels/docked_panel_strip.h
@@ -54,10 +54,16 @@ class DockedPanelStrip : public PanelStrip,
virtual void RestorePanel(Panel* panel) OVERRIDE;
virtual bool IsPanelMinimized(const Panel* panel) const OVERRIDE;
virtual bool CanShowPanelAsActive(const Panel* panel) const OVERRIDE;
+ virtual void SavePanelPlacement(Panel* panel) OVERRIDE;
+ virtual void RestorePanelToSavedPlacement() OVERRIDE;
+ virtual void DiscardSavedPanelPlacement() OVERRIDE;
virtual bool CanDragPanel(const Panel* panel) const OVERRIDE;
- virtual void StartDraggingPanel(Panel* panel) OVERRIDE;
- virtual void DragPanel(Panel* panel, int delta_x, int delta_y) OVERRIDE;
- virtual void EndDraggingPanel(Panel* panel, bool cancelled) OVERRIDE;
+ virtual void StartDraggingPanelWithinStrip(Panel* panel) OVERRIDE;
+ virtual void DragPanelWithinStrip(Panel* panel,
+ int delta_x,
+ int delta_y) OVERRIDE;
+ virtual void EndDraggingPanelWithinStrip(Panel* panel,
+ bool aborted) OVERRIDE;
// Invoked when a panel's expansion state changes.
void OnPanelExpansionStateChanged(Panel* panel);
@@ -109,9 +115,29 @@ class DockedPanelStrip : public PanelStrip,
BRING_DOWN
};
+ struct PanelPlacement {
+ Panel* panel;
+ // Used to remember the panel to the left of |panel|, if any, for use when
+ // restoring the position of |panel|. Will be updated if this panel is
+ // closed.
+ Panel* left_panel_;
+
+ PanelPlacement() : panel(NULL) { }
+ };
+
// Overridden from PanelMouseWatcherObserver:
virtual void OnMouseMove(const gfx::Point& mouse_position) OVERRIDE;
+ // Helper methods to put the panel to the collection.
+ void InsertPreviewedPanel(Panel* panel);
+ void InsertExistingPanel(Panel* panel);
+ void InsertNewlyCreatedPanel(Panel* panel);
+
+ // Ensures that there is sufficient space in the strip to add a panel with
+ // the specified width. We might need to bump panels in the strip to make
+ // room for this panel.
+ void EnsureAvailableSpace(int width);
+
// Keep track of the minimized panels to control mouse watching.
void IncrementMinimizedPanels();
void DecrementMinimizedPanels();
@@ -141,8 +167,6 @@ class DockedPanelStrip : public PanelStrip,
// panels are (at least briefly) visible before entering overflow.
void DelayedMovePanelToOverflow(Panel* panel);
- Panel* dragging_panel() const;
-
PanelManager* panel_manager_; // Weak, owns us.
// All panels in the panel strip must fit within this area.
@@ -161,10 +185,6 @@ class DockedPanelStrip : public PanelStrip,
// resides.
Panels::iterator dragging_panel_current_iterator_;
- // Referring to original position in |panels_| where the dragging panel
- // resides.
- Panels::iterator dragging_panel_original_iterator_;
-
// Delayed transitions support. Sometimes transitions between minimized and
// title-only states are delayed, for better usability with Taskbars/Docks.
TitlebarAction delayed_titlebar_action_;
@@ -172,6 +192,9 @@ class DockedPanelStrip : public PanelStrip,
// Owned by MessageLoop after posting.
base::WeakPtrFactory<DockedPanelStrip> titlebar_action_factory_;
+ // Used to save the placement information for a panel.
+ PanelPlacement saved_panel_placement_;
+
static const int kPanelsHorizontalSpacing = 4;
// Absolute minimum width and height for panels, including non-client area.

Powered by Google App Engine
This is Rietveld 408576698