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 UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ | 5 #ifndef UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ |
6 #define UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ | 6 #define UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "ui/aura/layout_manager.h" | 12 #include "ui/aura/layout_manager.h" |
12 #include "ui/aura_shell/aura_shell_export.h" | 13 #include "ui/aura_shell/aura_shell_export.h" |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class MouseEvent; | 16 class MouseEvent; |
16 class Window; | 17 class Window; |
17 } | 18 } |
18 | 19 |
19 namespace gfx { | 20 namespace gfx { |
20 class Rect; | 21 class Rect; |
21 } | 22 } |
22 | 23 |
23 namespace aura_shell { | 24 namespace aura_shell { |
24 namespace internal { | 25 namespace internal { |
25 | 26 |
| 27 class ShowStateController; |
26 class WorkspaceManager; | 28 class WorkspaceManager; |
27 | 29 |
28 // LayoutManager for the default window container. | 30 // LayoutManager for the default window container. |
29 class AURA_SHELL_EXPORT DefaultContainerLayoutManager | 31 class AURA_SHELL_EXPORT DefaultContainerLayoutManager |
30 : public aura::LayoutManager { | 32 : public aura::LayoutManager { |
31 public: | 33 public: |
32 DefaultContainerLayoutManager(aura::Window* owner, | 34 DefaultContainerLayoutManager(aura::Window* owner, |
33 WorkspaceManager* workspace_manager); | 35 WorkspaceManager* workspace_manager); |
34 virtual ~DefaultContainerLayoutManager(); | 36 virtual ~DefaultContainerLayoutManager(); |
35 | 37 |
| 38 // Returns the workspace manager for this container. |
| 39 WorkspaceManager* workspace_manager() { |
| 40 return workspace_manager_; |
| 41 } |
| 42 |
36 // Invoked when a window receives drag event. | 43 // Invoked when a window receives drag event. |
37 void PrepareForMoveOrResize(aura::Window* drag, aura::MouseEvent* event); | 44 void PrepareForMoveOrResize(aura::Window* drag, aura::MouseEvent* event); |
38 | 45 |
39 // Invoked when a drag event didn't start any drag operation. | 46 // Invoked when a drag event didn't start any drag operation. |
40 void CancelMoveOrResize(aura::Window* drag, aura::MouseEvent* event); | 47 void CancelMoveOrResize(aura::Window* drag, aura::MouseEvent* event); |
41 | 48 |
42 // Invoked when a drag event moved the |window|. | 49 // Invoked when a drag event moved the |window|. |
43 void ProcessMove(aura::Window* window, aura::MouseEvent* event); | 50 void ProcessMove(aura::Window* window, aura::MouseEvent* event); |
44 | 51 |
45 // Invoked when a user finished moving window. | 52 // Invoked when a user finished moving window. |
46 void EndMove(aura::Window* drag, aura::MouseEvent* evnet); | 53 void EndMove(aura::Window* drag, aura::MouseEvent* evnet); |
47 | 54 |
48 // Invoked when a user finished resizing window. | 55 // Invoked when a user finished resizing window. |
49 void EndResize(aura::Window* drag, aura::MouseEvent* evnet); | 56 void EndResize(aura::Window* drag, aura::MouseEvent* evnet); |
50 | 57 |
51 // If true, |CalculateBoundsForChild| does nothing. Use in situations where | 58 // If true, |SetChildBounds| does not modify the requested bounds. |
52 // you want to circumvent what CalculateBoundsForChild() would normally do. | 59 // Use in situations where you want to circumvent what |
| 60 // SetChildBounds() would normally do. |
53 void set_ignore_calculate_bounds(bool value) { | 61 void set_ignore_calculate_bounds(bool value) { |
54 ignore_calculate_bounds_ = value; | 62 ignore_calculate_bounds_ = value; |
55 } | 63 } |
56 | 64 |
57 // Overridden from aura::LayoutManager: | 65 // Overridden from aura::LayoutManager: |
58 virtual void OnWindowResized() OVERRIDE; | 66 virtual void OnWindowResized() OVERRIDE; |
59 virtual void OnWindowAdded(aura::Window* child) OVERRIDE; | 67 virtual void OnWindowAdded(aura::Window* child) OVERRIDE; |
60 virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; | 68 virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; |
61 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 69 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
62 bool visibile) OVERRIDE; | 70 bool visibile) OVERRIDE; |
63 virtual void CalculateBoundsForChild(aura::Window* child, | 71 virtual void SetChildBounds(aura::Window* child, |
64 gfx::Rect* requested_bounds) OVERRIDE; | 72 const gfx::Rect& requested_bounds) OVERRIDE; |
65 private: | 73 private: |
66 aura::Window* owner_; | 74 aura::Window* owner_; |
67 | 75 |
68 WorkspaceManager* workspace_manager_; | 76 WorkspaceManager* workspace_manager_; |
69 | 77 |
70 // A window that are currently moved or resized. Used to put | 78 // A window that are currently moved or resized. Used to put |
71 // different constraints on drag window. | 79 // different constraints on drag window. |
72 aura::Window* drag_window_; | 80 aura::Window* drag_window_; |
73 | 81 |
74 // A flag to control layout behavior. This is set to true while | 82 // A flag to control layout behavior. This is set to true while |
75 // workspace manager is laying out children and LayoutManager | 83 // workspace manager is laying out children and LayoutManager |
76 // ignores bounds check. | 84 // ignores bounds check. |
77 bool ignore_calculate_bounds_; | 85 bool ignore_calculate_bounds_; |
78 | 86 |
| 87 scoped_ptr<ShowStateController> show_state_controller_; |
| 88 |
79 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManager); | 89 DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManager); |
80 }; | 90 }; |
81 | 91 |
82 } // namespace internal | 92 } // namespace internal |
83 } // namespace aura_shell | 93 } // namespace aura_shell |
84 | 94 |
85 #endif // UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ | 95 #endif // UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ |
OLD | NEW |