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

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

Issue 11669018: Support dragging panels to stack and snap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix CrOS build for relanding Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.cc ('k') | chrome/browser/ui/panels/stacked_panel_collection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/stacked_panel_collection.h
diff --git a/chrome/browser/ui/panels/stacked_panel_collection.h b/chrome/browser/ui/panels/stacked_panel_collection.h
index 8d746ba5ed29c02945e0c452cd14caa62b843a1f..c7707f65a9d9b5b2579dc229f9703449f8cf339c 100644
--- a/chrome/browser/ui/panels/stacked_panel_collection.h
+++ b/chrome/browser/ui/panels/stacked_panel_collection.h
@@ -9,9 +9,14 @@
#include <vector>
#include "base/basictypes.h"
#include "chrome/browser/ui/panels/panel_collection.h"
+#include "chrome/browser/ui/panels/panel_constants.h"
#include "ui/gfx/rect.h"
+class NativePanelStack;
class PanelManager;
+namespace gfx {
+class Vector2d;
+}
class StackedPanelCollection : public PanelCollection {
public:
@@ -53,17 +58,39 @@ class StackedPanelCollection : public PanelCollection {
Panel* GetPanelAbove(Panel* panel) const;
bool HasPanel(Panel* panel) const;
- bool empty() const { return panels_.empty(); }
+ void MoveAllDraggingPanelsInstantly(const gfx::Vector2d& delta_origin);
+
+ NativePanelStack* native_stack() const { return native_stack_; }
int num_panels() const { return panels_.size(); }
const Panels& panels() const { return panels_; }
- Panel* top_panel() const { return panels_.front(); }
- Panel* bottom_panel() const { return panels_.back(); }
+ Panel* top_panel() const { return panels_.empty() ? NULL : panels_.front(); }
+ Panel* bottom_panel() const {
+ return panels_.empty() ? NULL : panels_.back();
+ }
private:
- PanelManager* panel_manager_; // Weak, owns us.
+ struct PanelPlacement {
+ Panel* panel;
+ gfx::Point position;
+ // Used to remember the top panel, if different from |panel|, for use when
+ // restoring it. When there're only 2 panels in the stack and the bottom
+ // panel is being dragged out of the stack, both panels will be moved to
+ // the detached collection. We need to track the top panel in order to
+ // put it back to the same stack of the dragging panel.
+ Panel* top_panel;
+
+ PanelPlacement() : panel(NULL), top_panel(NULL) { }
+ };
+
+ PanelManager* panel_manager_;
+
+ NativePanelStack* native_stack_; // Weak, owns us.
Panels panels_; // The top panel is in the front of the list.
+ // Used to save the placement information for a panel.
+ PanelPlacement saved_panel_placement_;
+
DISALLOW_COPY_AND_ASSIGN(StackedPanelCollection);
};
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.cc ('k') | chrome/browser/ui/panels/stacked_panel_collection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698