OLD | NEW |
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 ASH_WM_PANEL_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_PANEL_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_PANEL_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_PANEL_LAYOUT_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/launcher/launcher_icon_observer.h" |
12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "ui/aura/layout_manager.h" | 15 #include "ui/aura/layout_manager.h" |
15 | 16 |
16 namespace aura { | 17 namespace aura { |
17 class Window; | 18 class Window; |
18 } | 19 } |
19 | 20 |
20 namespace gfx { | 21 namespace gfx { |
21 class Rect; | 22 class Rect; |
22 } | 23 } |
23 | 24 |
24 namespace ash { | 25 namespace ash { |
| 26 class Launcher; |
| 27 |
25 namespace internal { | 28 namespace internal { |
26 | 29 |
27 // PanelLayoutManager is responsible for organizing panels within the | 30 // PanelLayoutManager is responsible for organizing panels within the |
28 // workspace. It is associated with a specific container window (i.e. | 31 // workspace. It is associated with a specific container window (i.e. |
29 // kShellWindowId_PanelContainer) and controls the layout of any windows | 32 // kShellWindowId_PanelContainer) and controls the layout of any windows |
30 // added to that container. | 33 // added to that container. |
31 // | 34 // |
32 // The constructor takes a |panel_container| argument which is expected to set | 35 // The constructor takes a |panel_container| argument which is expected to set |
33 // its layout manager to this instance, e.g.: | 36 // its layout manager to this instance, e.g.: |
34 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); | 37 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); |
35 | 38 |
36 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager { | 39 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager, |
| 40 public ash::LauncherIconObserver { |
37 public: | 41 public: |
38 explicit PanelLayoutManager(aura::Window* panel_container); | 42 explicit PanelLayoutManager(aura::Window* panel_container); |
39 virtual ~PanelLayoutManager(); | 43 virtual ~PanelLayoutManager(); |
40 | 44 |
41 void StartDragging(aura::Window* panel); | 45 void StartDragging(aura::Window* panel); |
42 void FinishDragging(); | 46 void FinishDragging(); |
43 | 47 |
44 void ToggleMinimize(aura::Window* panel); | 48 void ToggleMinimize(aura::Window* panel); |
45 | 49 |
| 50 void SetLauncher(ash::Launcher* launcher); |
| 51 |
46 // Overridden from aura::LayoutManager: | 52 // Overridden from aura::LayoutManager: |
47 virtual void OnWindowResized() OVERRIDE; | 53 virtual void OnWindowResized() OVERRIDE; |
48 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 54 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
49 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 55 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
50 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 56 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
51 bool visibile) OVERRIDE; | 57 bool visibile) OVERRIDE; |
52 virtual void SetChildBounds(aura::Window* child, | 58 virtual void SetChildBounds(aura::Window* child, |
53 const gfx::Rect& requested_bounds) OVERRIDE; | 59 const gfx::Rect& requested_bounds) OVERRIDE; |
54 | 60 |
| 61 // Overriden from ash::LauncherIconObserver |
| 62 virtual void OnLauncherIconPositionsChanged() OVERRIDE; |
| 63 |
55 private: | 64 private: |
56 typedef std::list<aura::Window*> PanelList; | 65 typedef std::list<aura::Window*> PanelList; |
57 | 66 |
58 // Called whenever the panel layout might change. | 67 // Called whenever the panel layout might change. |
59 void Relayout(); | 68 void Relayout(); |
60 | 69 |
61 // Parent window associated with this layout manager. | 70 // Parent window associated with this layout manager. |
62 aura::Window* panel_container_; | 71 aura::Window* panel_container_; |
63 // Protect against recursive calls to Relayout(). | 72 // Protect against recursive calls to Relayout(). |
64 bool in_layout_; | 73 bool in_layout_; |
65 // Ordered list of unowned pointers to panel windows. | 74 // Ordered list of unowned pointers to panel windows. |
66 PanelList panel_windows_; | 75 PanelList panel_windows_; |
67 | 76 |
68 aura::Window* dragged_panel_; | 77 aura::Window* dragged_panel_; |
69 | 78 |
70 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); | 79 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |
71 }; | 80 }; |
72 | 81 |
73 } // namespace internal | 82 } // namespace internal |
74 } // namespace ash | 83 } // namespace ash |
75 | 84 |
76 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ | 85 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ |
OLD | NEW |