| 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_WINDOW_UTIL_H_ | 5 #ifndef ASH_WM_WINDOW_UTIL_H_ |
| 6 #define ASH_WM_WINDOW_UTIL_H_ | 6 #define ASH_WM_WINDOW_UTIL_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/base/ui_base_types.h" | 10 #include "ui/base/ui_base_types.h" |
| 11 #include "ui/gfx/rect.h" |
| 11 | 12 |
| 12 namespace aura { | 13 namespace aura { |
| 13 class RootWindow; | 14 class RootWindow; |
| 14 class Window; | 15 class Window; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace gfx { | |
| 18 class Rect; | |
| 19 } | |
| 20 | |
| 21 namespace ui { | 18 namespace ui { |
| 22 class Event; | 19 class Event; |
| 23 class Layer; | 20 class Layer; |
| 24 } | 21 } |
| 25 | 22 |
| 26 namespace ash { | 23 namespace ash { |
| 27 // We force at least this many DIPs for any window on the screen. | 24 // We force at least this many DIPs for any window on the screen. |
| 28 const int kMinimumOnScreenArea = 10; | 25 const int kMinimumOnScreenArea = 10; |
| 29 | 26 |
| 30 namespace wm { | 27 namespace wm { |
| 31 | 28 |
| 29 // The edge to snap a window to. |
| 30 enum SnapEdge { |
| 31 SNAP_LEFT_EDGE, |
| 32 SNAP_RIGHT_EDGE |
| 33 }; |
| 34 |
| 32 // Convenience setters/getters for |aura::client::kRootWindowActiveWindow|. | 35 // Convenience setters/getters for |aura::client::kRootWindowActiveWindow|. |
| 33 ASH_EXPORT void ActivateWindow(aura::Window* window); | 36 ASH_EXPORT void ActivateWindow(aura::Window* window); |
| 34 ASH_EXPORT void DeactivateWindow(aura::Window* window); | 37 ASH_EXPORT void DeactivateWindow(aura::Window* window); |
| 35 ASH_EXPORT bool IsActiveWindow(aura::Window* window); | 38 ASH_EXPORT bool IsActiveWindow(aura::Window* window); |
| 36 ASH_EXPORT aura::Window* GetActiveWindow(); | 39 ASH_EXPORT aura::Window* GetActiveWindow(); |
| 37 ASH_EXPORT bool CanActivateWindow(aura::Window* window); | 40 ASH_EXPORT bool CanActivateWindow(aura::Window* window); |
| 38 | 41 |
| 39 // Retrieves the activatable window for |window|. If |window| is activatable, | 42 // Retrieves the activatable window for |window|. If |window| is activatable, |
| 40 // this will just return it, otherwise it will climb the parent/transient parent | 43 // this will just return it, otherwise it will climb the parent/transient parent |
| 41 // chain looking for a window that is activatable, per the ActivationController. | 44 // chain looking for a window that is activatable, per the ActivationController. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 78 |
| 76 // Minimizes |window|, which must not be NULL. | 79 // Minimizes |window|, which must not be NULL. |
| 77 ASH_EXPORT void MinimizeWindow(aura::Window* window); | 80 ASH_EXPORT void MinimizeWindow(aura::Window* window); |
| 78 | 81 |
| 79 // Restores |window|, which must not be NULL. | 82 // Restores |window|, which must not be NULL. |
| 80 ASH_EXPORT void RestoreWindow(aura::Window* window); | 83 ASH_EXPORT void RestoreWindow(aura::Window* window); |
| 81 | 84 |
| 82 // Maximizes or restores |window| based on its state. |window| must not be NULL. | 85 // Maximizes or restores |window| based on its state. |window| must not be NULL. |
| 83 ASH_EXPORT void ToggleMaximizedWindow(aura::Window* window); | 86 ASH_EXPORT void ToggleMaximizedWindow(aura::Window* window); |
| 84 | 87 |
| 88 // Returns the bounds for snapped windows at |edge| in parent coordinates. |
| 89 ASH_EXPORT gfx::Rect GetSnappedWindowBoundsInParent(aura::Window* window, |
| 90 SnapEdge edge); |
| 91 |
| 92 // Snaps |window| to the left or the right edge. |
| 93 ASH_EXPORT void SnapWindowToEdge(aura::Window*, SnapEdge edge); |
| 94 |
| 85 // Moves the window to the center of the display. | 95 // Moves the window to the center of the display. |
| 86 ASH_EXPORT void CenterWindow(aura::Window* window); | 96 ASH_EXPORT void CenterWindow(aura::Window* window); |
| 87 | 97 |
| 88 // Returns true if |window|'s position can automatically be managed. | 98 // Returns true if |window|'s position can automatically be managed. |
| 89 ASH_EXPORT bool IsWindowPositionManaged(const aura::Window* window); | 99 ASH_EXPORT bool IsWindowPositionManaged(const aura::Window* window); |
| 90 | 100 |
| 91 // Change the |window|'s position manageability to |managed|. | 101 // Change the |window|'s position manageability to |managed|. |
| 92 ASH_EXPORT void SetWindowPositionManaged(aura::Window* window, bool managed); | 102 ASH_EXPORT void SetWindowPositionManaged(aura::Window* window, bool managed); |
| 93 | 103 |
| 94 // Change the availability of animation to the fullscreen of the |window|. | 104 // Change the availability of animation to the fullscreen of the |window|. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 137 |
| 128 // Moves |window| to the root window where the |event| occured if it is not | 138 // Moves |window| to the root window where the |event| occured if it is not |
| 129 // already in the same root window. Returns true if |window| was moved. | 139 // already in the same root window. Returns true if |window| was moved. |
| 130 ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window, | 140 ASH_EXPORT bool MoveWindowToEventRoot(aura::Window* window, |
| 131 const ui::Event& event); | 141 const ui::Event& event); |
| 132 | 142 |
| 133 } // namespace wm | 143 } // namespace wm |
| 134 } // namespace ash | 144 } // namespace ash |
| 135 | 145 |
| 136 #endif // ASH_WM_WINDOW_UTIL_H_ | 146 #endif // ASH_WM_WINDOW_UTIL_H_ |
| OLD | NEW |