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