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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ui/gfx/point.h"
9 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
10 11
11 class Panel; 12 class Panel;
12 13
13 // Common base class for a collection of panels. Subclasses manage 14 // Common base class for a collection of panels. Subclasses manage
14 // various layouts for displaying panels in the collection. 15 // various layouts for displaying panels in the collection.
15 class PanelStrip { 16 class PanelStrip {
16 public: 17 public:
17 // Types of layout for the panel collections. 18 // Types of layout for the panel collections.
18 enum Type { 19 enum Type {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Updates the display to show |panel| as active. 59 // Updates the display to show |panel| as active.
59 virtual void ActivatePanel(Panel* panel) = 0; 60 virtual void ActivatePanel(Panel* panel) = 0;
60 61
61 // Updates the display to show |panel| as minimized/restored. 62 // Updates the display to show |panel| as minimized/restored.
62 virtual void MinimizePanel(Panel* panel) = 0; 63 virtual void MinimizePanel(Panel* panel) = 0;
63 virtual void RestorePanel(Panel* panel) = 0; 64 virtual void RestorePanel(Panel* panel) = 0;
64 65
65 // Returns true if |panel| can be shown as active. 66 // Returns true if |panel| can be shown as active.
66 virtual bool CanShowPanelAsActive(const Panel* panel) const = 0; 67 virtual bool CanShowPanelAsActive(const Panel* panel) const = 0;
67 68
69 // Saves/loads/discards the placement information of |panel|. This is useful
70 // int bringing back the dragging panel to its original positioning when the
jennb 2012/03/03 02:19:33 typo: int
jianli 2012/03/07 19:14:31 Done.
71 // drag is cancelled.
72 virtual void SavePanelPlacement(Panel* panel) = 0;
73 virtual void LoadSavedPanelPlacement() = 0;
jennb 2012/03/03 02:19:33 RestorePanelToSavedPlacement()?
jianli 2012/03/07 19:14:31 Done.
74 virtual void DiscardSavedPanelPlacement() = 0;
jennb 2012/03/03 02:19:33 Please comment that drag controller will only call
jianli 2012/03/07 19:14:31 Done.
75
68 // Returns true if |panel| is draggable. 76 // Returns true if |panel| is draggable.
69 virtual bool CanDragPanel(const Panel* panel) const = 0; 77 virtual bool CanDragPanel(const Panel* panel) const = 0;
70 78
71 // Drags |panel| in the bounds of this strip. 79 // Starts dragging |panel| within this strip. The panel should already be
72 virtual void StartDraggingPanel(Panel* panel) = 0; 80 // in this strip.
73 // |delta_x| and |delta_y| denotes how much the mouse has been moved since 81 virtual void StartDraggingPanelLocally(Panel* panel) = 0;
jennb 2012/03/03 02:19:33 s/Locally/WithinStrip or InStrip Locally might be
jianli 2012/03/07 19:14:31 Done.
74 // last time when DragPanel or StartDraggingPanel is called. 82
75 virtual void DragPanel(Panel* panel, int delta_x, int delta_y) = 0; 83 // Drags |panel| within this strip.
76 virtual void EndDraggingPanel(Panel* panel, bool cancelled) = 0; 84 // |delta_x| and |delta_y| represents the offset from the last mouse location
85 // when StartDraggingPanelLocally or DragPanelLocally is called.
86 virtual void DragPanelLocally(Panel* panel, int delta_x, int delta_y) = 0;
87
88 // Ends dragging |panel| within this strip.
89 // If |cancelled| is false, |panel| will be positioned to its finalized
90 // position. Otherwise, |panel| will stay as it is.
jennb 2012/03/03 02:19:33 Add explanation for how the drag is truly cancelle
jianli 2012/03/07 19:14:31 Done.
91 virtual void EndDraggingPanelLocally(Panel* panel, bool cancelled) = 0;
92
93 // Adds |panel| to the collection of panels, positions it at |position|
94 // in screen coordinates, and starts dragging it within this strip. This is
95 // invoked when the drag leaves other strip and enters this strip.
96 virtual void AddDraggingPanel(Panel* panel, const gfx::Point& position) = 0;
77 97
78 protected: 98 protected:
79 explicit PanelStrip(Type type); 99 explicit PanelStrip(Type type);
80 virtual ~PanelStrip(); 100 virtual ~PanelStrip();
81 101
82 const Type type_; // Type of this panel strip. 102 const Type type_; // Type of this panel strip.
83 }; 103 };
84 104
85 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 105 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698