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

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: Change per feedback 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
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..9d01d4f55d657b744d777e585f423d0487859c59 100644
--- a/chrome/browser/ui/panels/stacked_panel_collection.h
+++ b/chrome/browser/ui/panels/stacked_panel_collection.h
@@ -9,9 +9,15 @@
#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/native_widget_types.h"
#include "ui/gfx/rect.h"
+class NativePanelStack;
class PanelManager;
+namespace gfx {
+class Vector2d;
+}
class StackedPanelCollection : public PanelCollection {
public:
@@ -53,17 +59,37 @@ class StackedPanelCollection : public PanelCollection {
Panel* GetPanelAbove(Panel* panel) const;
bool HasPanel(Panel* panel) const;
- bool empty() const { return panels_.empty(); }
+ gfx::NativeWindow GetNativeWindow() const;
+
+ void MoveAllDraggingPanels(const gfx::Vector2d& delta_origin);
+
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
Dmitry Titov 2013/01/09 02:29:50 Could you improve this comment, it's not clear wah
jianli 2013/01/09 21:00:59 Done.
+ // restoring it.
+ Panel* top_panel;
+
+ PanelPlacement() : panel(NULL) { }
Dmitry Titov 2013/01/09 02:29:50 initialize top_panel(NULL) too
jianli 2013/01/09 21:00:59 Done.
+ };
+
+ PanelManager* panel_manager_;
+
+ NativePanelStack* native_stack_; // Weak, own 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);
};

Powered by Google App Engine
This is Rietveld 408576698