OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <vector> | 10 #include <vector> |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/ui/panels/panel.h" |
13 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
14 | 15 |
15 class Browser; | 16 class Browser; |
16 class Panel; | 17 class Panel; |
17 | 18 |
18 // This class manages a set of panels. | 19 // This class manages a set of panels. |
19 class PanelManager { | 20 class PanelManager { |
20 public: | 21 public: |
21 // Returns a single instance. | 22 // Returns a single instance. |
22 static PanelManager* GetInstance(); | 23 static PanelManager* GetInstance(); |
23 | 24 |
24 ~PanelManager(); | 25 ~PanelManager(); |
25 | 26 |
26 // Called when the display is changed, i.e. work area is updated. | 27 // Called when the display is changed, i.e. work area is updated. |
27 void OnDisplayChanged(); | 28 void OnDisplayChanged(); |
28 | 29 |
29 // Creates a panel and returns it. The panel might be queued for display | 30 // Creates a panel and returns it. The panel might be queued for display |
30 // later. | 31 // later. |
31 Panel* CreatePanel(Browser* browser); | 32 Panel* CreatePanel(Browser* browser); |
32 | 33 |
33 // Removes the given panel. Both active and pending panel lists are checked. | 34 // Removes the given panel. Both active and pending panel lists are checked. |
34 // If an active panel is removed, pending panels could put on display if we | 35 // If an active panel is removed, pending panels could be displayed if space |
35 // have spaces. | 36 // allows. |
36 void Remove(Panel* panel); | 37 void Remove(Panel* panel); |
37 | 38 |
38 // Minimizes all panels. This only applies to active panels since only them | |
39 // are visible. | |
40 void MinimizeAll(); | |
41 | |
42 // Restores all panels. This only applies to active panels since only them | |
43 // are visible. | |
44 void RestoreAll(); | |
45 | |
46 // Removes all active panels. Pending panels will be processed for display. | 39 // Removes all active panels. Pending panels will be processed for display. |
47 void RemoveAllActive(); | 40 void RemoveAllActive(); |
48 | 41 |
49 // Drags the given active panel. | 42 // Drags the given active panel. |
50 void StartDragging(Panel* panel); | 43 void StartDragging(Panel* panel); |
51 void Drag(int delta_x); | 44 void Drag(int delta_x); |
52 void EndDragging(bool cancelled); | 45 void EndDragging(bool cancelled); |
53 | 46 |
| 47 // Should we bring up the titlebar, given the current mouse point? |
| 48 bool ShouldBringUpTitleBarForAllMinimizedPanels(int mouse_x, |
| 49 int mouse_y) const; |
| 50 |
| 51 // Brings up or down the title-bar for all minimized panels. |
| 52 void BringUpOrDownTitleBarForAllMinimizedPanels(bool bring_up); |
| 53 |
54 // Returns the number of active panels. | 54 // Returns the number of active panels. |
55 int active_count() const { return active_panels_.size(); } | 55 int active_count() const { return active_panels_.size(); } |
56 | 56 |
57 private: | 57 private: |
58 typedef std::vector<Panel*> ActivePanels; | 58 typedef std::vector<Panel*> ActivePanels; |
59 typedef std::deque<Panel*> PendingPanels; | 59 typedef std::deque<Panel*> PendingPanels; |
60 | 60 |
61 PanelManager(); | 61 PanelManager(); |
62 | 62 |
63 // Handles all the panels that're delayed to be removed. | 63 // Handles all the panels that're delayed to be removed. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Bounds of the panel to drag. It is first set to the original bounds when | 114 // Bounds of the panel to drag. It is first set to the original bounds when |
115 // the dragging happens. Then it is updated to the position that will be set | 115 // the dragging happens. Then it is updated to the position that will be set |
116 // to when the dragging ends. | 116 // to when the dragging ends. |
117 gfx::Rect dragging_panel_bounds_; | 117 gfx::Rect dragging_panel_bounds_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(PanelManager); | 119 DISALLOW_COPY_AND_ASSIGN(PanelManager); |
120 }; | 120 }; |
121 | 121 |
122 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ | 122 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MANAGER_H_ |
OLD | NEW |