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

Side by Side Diff: chrome/browser/ui/panels/detached_panel_strip.h

Issue 9403035: Refactor intra-strip panel drags by introducing PanelDragController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 10 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_DETACHED_PANEL_STRIP_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_
6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ 6 #define CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/ui/panels/panel.h" 11 #include "chrome/browser/ui/panels/panel.h"
12 #include "chrome/browser/ui/panels/panel_strip.h" 12 #include "chrome/browser/ui/panels/panel_strip.h"
13 #include "ui/gfx/point.h"
13 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
14 15
15 class Browser; 16 class Browser;
16 class PanelManager; 17 class PanelManager;
17 18
18 // This class manages a group of free-floating panels. 19 // This class manages a group of free-floating panels.
19 class DetachedPanelStrip : public PanelStrip { 20 class DetachedPanelStrip : public PanelStrip {
20 public: 21 public:
21 typedef std::set<Panel*> Panels; 22 typedef std::set<Panel*> Panels;
22 23
23 explicit DetachedPanelStrip(PanelManager* panel_manager); 24 explicit DetachedPanelStrip(PanelManager* panel_manager);
24 virtual ~DetachedPanelStrip(); 25 virtual ~DetachedPanelStrip();
25 26
26 // PanelStrip OVERRIDES: 27 // PanelStrip OVERRIDES:
27 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE; 28 virtual void SetDisplayArea(const gfx::Rect& display_area) OVERRIDE;
28 virtual void RefreshLayout() OVERRIDE; 29 virtual void RefreshLayout() OVERRIDE;
29 virtual void AddPanel(Panel* panel) OVERRIDE; 30 virtual void AddPanel(Panel* panel) OVERRIDE;
30 virtual bool RemovePanel(Panel* panel) OVERRIDE; 31 virtual bool RemovePanel(Panel* panel) OVERRIDE;
31 virtual void CloseAll() OVERRIDE; 32 virtual void CloseAll() OVERRIDE;
32 virtual void ResizePanelWindow( 33 virtual void ResizePanelWindow(
33 Panel* panel, 34 Panel* panel,
34 const gfx::Size& preferred_window_size) OVERRIDE; 35 const gfx::Size& preferred_window_size) OVERRIDE;
35 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE; 36 virtual void OnPanelAttentionStateChanged(Panel* panel) OVERRIDE;
36 virtual void ActivatePanel(Panel* panel) OVERRIDE; 37 virtual void ActivatePanel(Panel* panel) OVERRIDE;
37 virtual void MinimizePanel(Panel* panel) OVERRIDE; 38 virtual void MinimizePanel(Panel* panel) OVERRIDE;
38 virtual void RestorePanel(Panel* panel) OVERRIDE; 39 virtual void RestorePanel(Panel* panel) OVERRIDE;
40 virtual bool CanDragPanel(Panel* panel) const OVERRIDE;
41 virtual void StartDraggingPanel(Panel* panel) OVERRIDE;
42 virtual void DragPanel(int delta_x, int delta_y) OVERRIDE;
43 virtual void EndDraggingPanel(bool cancelled) OVERRIDE;
39 44
40 int num_panels() const { return panels_.size(); } 45 int num_panels() const { return panels_.size(); }
41 const Panels& panels() const { return panels_; } 46 const Panels& panels() const { return panels_; }
42 47
43 private: 48 private:
44 PanelManager* panel_manager_; // Weak, owns us. 49 PanelManager* panel_manager_; // Weak, owns us.
45 50
46 // All panels in the panel strip must fit within this area. 51 // All panels in the panel strip must fit within this area.
47 gfx::Rect display_area_; 52 gfx::Rect display_area_;
48 53
49 // Collection of all panels. 54 // Collection of all panels.
50 Panels panels_; 55 Panels panels_;
51 56
57 // Original position of the panel being dragged. This is used to get back to
58 // the original position when we cancel the dragging.
59 gfx::Point dragging_panel_original_position_;
jennb 2012/02/17 21:28:45 This feels like it belongs in drag controller. A
jianli 2012/02/17 23:52:56 Done.
60
52 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip); 61 DISALLOW_COPY_AND_ASSIGN(DetachedPanelStrip);
53 }; 62 };
54 63
55 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_ 64 #endif // CHROME_BROWSER_UI_PANELS_DETACHED_PANEL_STRIP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698