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

Unified Diff: chrome/browser/ui/panels/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: 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/panel_strip.h
diff --git a/chrome/browser/ui/panels/panel_strip.h b/chrome/browser/ui/panels/panel_strip.h
index c1da8f4c5bf6d5cdd518b88acbb5796ebb237a71..422bb4a12fbad0f8203811ca9f4455850c4251fb 100644
--- a/chrome/browser/ui/panels/panel_strip.h
+++ b/chrome/browser/ui/panels/panel_strip.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
#pragma once
+#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
class Panel;
@@ -66,15 +67,36 @@ class PanelStrip {
// Returns true if |panel| can be shown as active.
virtual bool CanShowPanelAsActive(const Panel* panel) const = 0;
+ // Saves/restores/discards the placement information of |panel|. This is
+ // useful in bringing back the dragging panel to its original positioning
+ // when the drag is cancelled. After the placement information is saved,
+ // the caller should only call one of RestorePanelToSavedPlacement and
jennb 2012/03/08 23:41:09 s/and/or
jianli 2012/03/09 21:48:58 Done.
+ // DiscardSavedPanelPlacement.
+ virtual void SavePanelPlacement(Panel* panel) = 0;
+ virtual void RestorePanelToSavedPlacement() = 0;
+ virtual void DiscardSavedPanelPlacement() = 0;
+
// Returns true if |panel| is draggable.
virtual bool CanDragPanel(const Panel* panel) const = 0;
- // Drags |panel| in the bounds of this strip.
- virtual void StartDraggingPanel(Panel* panel) = 0;
- // |delta_x| and |delta_y| denotes how much the mouse has been moved since
- // last time when DragPanel or StartDraggingPanel is called.
- virtual void DragPanel(Panel* panel, int delta_x, int delta_y) = 0;
- virtual void EndDraggingPanel(Panel* panel, bool cancelled) = 0;
+ // Starts dragging |panel| within this strip. The panel should already be
+ // in this strip.
+ virtual void StartDraggingPanelWithinStrip(Panel* panel) = 0;
+
+ // Drags |panel| within this strip.
+ // |delta_x| and |delta_y| represents the offset from the last mouse location
+ // when StartDraggingPanelWithinStrip or DragPanelWithinStrip is called.
+ virtual void DragPanelWithinStrip(Panel* panel, int delta_x, int delta_y) = 0;
jennb 2012/03/08 23:41:09 why deltas instead of mouse position?
jianli 2012/03/09 21:48:58 If mouse location, the strip has to keep track of
+
+ // Ends dragging |panel| within this strip. |aborted| means the drag within
+ // this strip is aborted due to one of the following:
+ // 1) the drag leaves this strip and enters other strip
+ // 2) the drag gets cancelled
+ // If |aborted| is true, |panel| will stay as it is; otherwise, it will be
jennb 2012/03/08 23:41:09 Perhaps the flag should be finalize_position inste
jianli 2012/03/09 21:48:58 I would prefer to use |abort| because for now the
+ // moved to its finalized position.
+ // The drag controller is responsible for restoring the panel back to its
+ // original strip and position when the drag gets cancelled.
+ virtual void EndDraggingPanelWithinStrip(Panel* panel, bool aborted) = 0;
protected:
explicit PanelStrip(Type type);

Powered by Google App Engine
This is Rietveld 408576698