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

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: Patch to land 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 {
19 DETACHED, // free-floating panels 20 DETACHED, // free-floating panels
20 DOCKED, // panels are 'docked' along the window's edge 21 DOCKED, // panels are 'docked' along the window's edge
21 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area 22 IN_OVERFLOW, // panels that cannot fit in the 'docked' panels area
22 }; 23 };
23 24
25 // Masks that control how the panel is added and positioned.
26 enum PositioningMask {
27 // The panel is added and placed at default position that is decided by the
28 // strip.
29 DEFAULT_POSITION = 0x0,
30 // The panel is being added based on its current known position.
31 KNOWN_POSITION = 0x1,
32 // Do not update panel bounds. Only valid with DEFAULT_POSITION.
33 DO_NOT_UPDATE_BOUNDS = 0x2
34 };
35
24 Type type() const { return type_; } 36 Type type() const { return type_; }
25 37
26 // Sets the bounds of the panel strip. 38 // Sets the bounds of the panel strip.
27 // |display_area| is in screen coordinates. 39 // |display_area| is in screen coordinates.
28 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0; 40 virtual void SetDisplayArea(const gfx::Rect& display_area) = 0;
29 41
30 // Updates the positioning of all panels in the collection, usually as 42 // Updates the positioning of all panels in the collection, usually as
31 // a result of removing or resizing a panel in collection. 43 // a result of removing or resizing a panel in collection.
32 virtual void RefreshLayout() = 0; 44 virtual void RefreshLayout() = 0;
33 45
34 // Adds |panel| to the collection of panels. 46 // Adds |panel| to the collection of panels.
35 virtual void AddPanel(Panel* panel) = 0; 47 // |positioning_mask| indicates how |panel| should be added and positioned.
48 virtual void AddPanel(Panel* panel, PositioningMask positioning_mask) = 0;
36 49
37 // Removes |panel| from the collection of panels. Invoked asynchronously 50 // Removes |panel| from the collection of panels. Invoked asynchronously
38 // after a panel has been closed. 51 // after a panel has been closed.
39 virtual void RemovePanel(Panel* panel) = 0; 52 virtual void RemovePanel(Panel* panel) = 0;
40 53
41 // Closes all panels in the collection. Panels will be removed after closing. 54 // Closes all panels in the collection. Panels will be removed after closing.
42 virtual void CloseAll() = 0; 55 virtual void CloseAll() = 0;
43 56
44 // Resizes the |panel| to the |preferred_window_size| and updates the layout 57 // Resizes the |panel| to the |preferred_window_size| and updates the layout
45 // of other panels in the collection accordingly. 58 // of other panels in the collection accordingly.
(...skipping 13 matching lines...) Expand all
59 72
60 // Updates the display to show |panel| as minimized/restored. 73 // Updates the display to show |panel| as minimized/restored.
61 virtual void MinimizePanel(Panel* panel) = 0; 74 virtual void MinimizePanel(Panel* panel) = 0;
62 virtual void RestorePanel(Panel* panel) = 0; 75 virtual void RestorePanel(Panel* panel) = 0;
63 76
64 virtual bool IsPanelMinimized(const Panel* panel) const = 0; 77 virtual bool IsPanelMinimized(const Panel* panel) const = 0;
65 78
66 // Returns true if |panel| can be shown as active. 79 // Returns true if |panel| can be shown as active.
67 virtual bool CanShowPanelAsActive(const Panel* panel) const = 0; 80 virtual bool CanShowPanelAsActive(const Panel* panel) const = 0;
68 81
82 // Saves/restores/discards the placement information of |panel|. This is
83 // useful in bringing back the dragging panel to its original positioning
84 // when the drag is cancelled. After the placement information is saved,
85 // the caller should only call one of RestorePanelToSavedPlacement or
86 // DiscardSavedPanelPlacement.
87 virtual void SavePanelPlacement(Panel* panel) = 0;
88 virtual void RestorePanelToSavedPlacement() = 0;
89 virtual void DiscardSavedPanelPlacement() = 0;
90
69 // Returns true if |panel| is draggable. 91 // Returns true if |panel| is draggable.
70 virtual bool CanDragPanel(const Panel* panel) const = 0; 92 virtual bool CanDragPanel(const Panel* panel) const = 0;
71 93
72 // Drags |panel| in the bounds of this strip. 94 // Starts dragging |panel| within this strip. The panel should already be
73 virtual void StartDraggingPanel(Panel* panel) = 0; 95 // in this strip.
74 // |delta_x| and |delta_y| denotes how much the mouse has been moved since 96 virtual void StartDraggingPanelWithinStrip(Panel* panel) = 0;
75 // last time when DragPanel or StartDraggingPanel is called. 97
76 virtual void DragPanel(Panel* panel, int delta_x, int delta_y) = 0; 98 // Drags |panel| within this strip.
77 virtual void EndDraggingPanel(Panel* panel, bool cancelled) = 0; 99 // |delta_x| and |delta_y| represents the offset from the last mouse location
100 // when StartDraggingPanelWithinStrip or DragPanelWithinStrip is called.
101 virtual void DragPanelWithinStrip(Panel* panel, int delta_x, int delta_y) = 0;
102
103 // Ends dragging |panel| within this strip. |aborted| means the drag within
104 // this strip is aborted due to one of the following:
105 // 1) the drag leaves this strip and enters other strip
106 // 2) the drag gets cancelled
107 // If |aborted| is true, |panel| will stay as it is; otherwise, it will be
108 // moved to its finalized position.
109 // The drag controller is responsible for restoring the panel back to its
110 // original strip and position when the drag gets cancelled.
111 virtual void EndDraggingPanelWithinStrip(Panel* panel, bool aborted) = 0;
78 112
79 protected: 113 protected:
80 explicit PanelStrip(Type type); 114 explicit PanelStrip(Type type);
81 virtual ~PanelStrip(); 115 virtual ~PanelStrip();
82 116
83 const Type type_; // Type of this panel strip. 117 const Type type_; // Type of this panel strip.
84 }; 118 };
85 119
86 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_ 120 #endif // CHROME_BROWSER_UI_PANELS_PANEL_STRIP_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_overflow_browsertest.cc ('k') | chrome/browser/ui/panels/panel_window_controller_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698