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_WORKSPACE_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
| 14 namespace aura { |
| 15 class RootWindow; |
| 16 } // namespace aura |
| 17 |
14 namespace ash { | 18 namespace ash { |
15 namespace internal { | 19 namespace internal { |
16 | 20 |
17 class PhantomWindowController; | 21 class PhantomWindowController; |
18 class SnapSizer; | 22 class SnapSizer; |
19 | 23 |
20 // WindowResizer implementation for workspaces. This enforces that windows are | 24 // WindowResizer implementation for workspaces. This enforces that windows are |
21 // not allowed to vertically move or resize outside of the work area. As windows | 25 // not allowed to vertically move or resize outside of the work area. As windows |
22 // are moved outside the work area they are shrunk. We remember the height of | 26 // are moved outside the work area they are shrunk. We remember the height of |
23 // the window before it was moved so that if the window is again moved up we | 27 // the window before it was moved so that if the window is again moved up we |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 int grid_size) const; | 102 int grid_size) const; |
99 | 103 |
100 // Returns true if the window touches the bottom edge of the work area. | 104 // Returns true if the window touches the bottom edge of the work area. |
101 bool TouchesBottomOfScreen() const; | 105 bool TouchesBottomOfScreen() const; |
102 | 106 |
103 // Returns a coordinate along the primary axis. Used to share code for | 107 // Returns a coordinate along the primary axis. Used to share code for |
104 // left/right multi window resize and top/bottom resize. | 108 // left/right multi window resize and top/bottom resize. |
105 int PrimaryAxisSize(const gfx::Size& size) const; | 109 int PrimaryAxisSize(const gfx::Size& size) const; |
106 int PrimaryAxisCoordinate(int x, int y) const; | 110 int PrimaryAxisCoordinate(int x, int y) const; |
107 | 111 |
108 // Updates the bounds of the phantom window. | 112 // Updates the bounds of the phantom window for window snapping. |
109 void UpdatePhantomWindow( | 113 void UpdatePhantomWindow( |
110 const gfx::Point& location, | 114 const gfx::Point& location, |
111 const gfx::Rect& bounds, | 115 const gfx::Rect& bounds, |
112 int grid_size); | 116 int grid_size); |
113 | 117 |
| 118 // Updates the bounds of the phantom window for window dragging. |
| 119 void UpdateDragPhantomWindow(aura::RootWindow* another_root, |
| 120 const gfx::Rect& window_bounds_in_screen); |
| 121 |
114 // Restacks the windows z-order position so that one of the windows is at the | 122 // Restacks the windows z-order position so that one of the windows is at the |
115 // top of the z-order, and the rest directly underneath it. | 123 // top of the z-order, and the rest directly underneath it. |
116 void RestackWindows(); | 124 void RestackWindows(); |
117 | 125 |
118 // Returns the SnapType for the specified point. SNAP_NONE is used if no | 126 // Returns the SnapType for the specified point. SNAP_NONE is used if no |
119 // snapping should be used. | 127 // snapping should be used. |
120 SnapType GetSnapType(const gfx::Point& location) const; | 128 SnapType GetSnapType(const gfx::Point& location) const; |
121 | 129 |
122 // Returns true if we should allow the mouse pointer to warp. | 130 // Returns true if we should allow the mouse pointer to warp. |
123 bool ShouldAllowMouseWarp() const; | 131 bool ShouldAllowMouseWarp() const; |
(...skipping 28 matching lines...) Expand all Loading... |
152 // Sum of sizes in |min_size_|. | 160 // Sum of sizes in |min_size_|. |
153 int total_min_; | 161 int total_min_; |
154 | 162 |
155 // Sum of the sizes in |initial_size_|. | 163 // Sum of the sizes in |initial_size_|. |
156 int total_initial_size_; | 164 int total_initial_size_; |
157 | 165 |
158 // Gives a previews of where the the window will end up. Only used if there | 166 // Gives a previews of where the the window will end up. Only used if there |
159 // is a grid and the caption is being dragged. | 167 // is a grid and the caption is being dragged. |
160 scoped_ptr<PhantomWindowController> phantom_window_controller_; | 168 scoped_ptr<PhantomWindowController> phantom_window_controller_; |
161 | 169 |
| 170 // For now, we show a phantom window on the other root window during dragging. |
| 171 // TODO(yusukes): Show a semi-transparent image (screen shot) of the window |
| 172 // instead. |
| 173 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; |
| 174 |
162 // Used to determine the target position of a snap. | 175 // Used to determine the target position of a snap. |
163 scoped_ptr<SnapSizer> snap_sizer_; | 176 scoped_ptr<SnapSizer> snap_sizer_; |
164 | 177 |
165 // Last SnapType. | 178 // Last SnapType. |
166 SnapType snap_type_; | 179 SnapType snap_type_; |
167 | 180 |
168 // Number of mouse moves since the last bounds change. Only used for phantom | 181 // Number of mouse moves since the last bounds change. Only used for phantom |
169 // placement to track when the mouse is moved while pushed against the edge of | 182 // placement to track when the mouse is moved while pushed against the edge of |
170 // the screen. | 183 // the screen. |
171 int num_mouse_moves_since_bounds_change_; | 184 int num_mouse_moves_since_bounds_change_; |
172 | 185 |
173 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 186 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
174 }; | 187 }; |
175 | 188 |
176 } // namespace internal | 189 } // namespace internal |
177 } // namespace ash | 190 } // namespace ash |
178 | 191 |
179 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 192 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |