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