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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 int grid_size) const; | 103 int grid_size) const; |
100 | 104 |
101 // Returns true if the window touches the bottom edge of the work area. | 105 // Returns true if the window touches the bottom edge of the work area. |
102 bool TouchesBottomOfScreen() const; | 106 bool TouchesBottomOfScreen() const; |
103 | 107 |
104 // Returns a coordinate along the primary axis. Used to share code for | 108 // Returns a coordinate along the primary axis. Used to share code for |
105 // left/right multi window resize and top/bottom resize. | 109 // left/right multi window resize and top/bottom resize. |
106 int PrimaryAxisSize(const gfx::Size& size) const; | 110 int PrimaryAxisSize(const gfx::Size& size) const; |
107 int PrimaryAxisCoordinate(int x, int y) const; | 111 int PrimaryAxisCoordinate(int x, int y) const; |
108 | 112 |
109 // Updates the bounds of the phantom window. | 113 // Updates the bounds of the phantom window for window snapping. |
110 void UpdatePhantomWindow( | 114 void UpdatePhantomWindow( |
111 const gfx::Point& location, | 115 const gfx::Point& location, |
112 const gfx::Rect& bounds, | 116 const gfx::Rect& bounds, |
113 int grid_size); | 117 int grid_size); |
114 | 118 |
| 119 // Updates the bounds of the phantom window for window dragging. |
| 120 void UpdateDragPhantomWindow(aura::RootWindow* another_root, |
| 121 const gfx::Rect& window_bounds_in_screen); |
| 122 |
115 // Restacks the windows z-order position so that one of the windows is at the | 123 // Restacks the windows z-order position so that one of the windows is at the |
116 // top of the z-order, and the rest directly underneath it. | 124 // top of the z-order, and the rest directly underneath it. |
117 void RestackWindows(); | 125 void RestackWindows(); |
118 | 126 |
119 // Returns the SnapType for the specified point. SNAP_NONE is used if no | 127 // Returns the SnapType for the specified point. SNAP_NONE is used if no |
120 // snapping should be used. | 128 // snapping should be used. |
121 SnapType GetSnapType(const gfx::Point& location) const; | 129 SnapType GetSnapType(const gfx::Point& location) const; |
122 | 130 |
123 aura::Window* window() const { return details_.window; } | 131 aura::Window* window() const { return details_.window; } |
124 | 132 |
(...skipping 25 matching lines...) Expand all Loading... |
150 // Sum of sizes in |min_size_|. | 158 // Sum of sizes in |min_size_|. |
151 int total_min_; | 159 int total_min_; |
152 | 160 |
153 // Sum of the sizes in |initial_size_|. | 161 // Sum of the sizes in |initial_size_|. |
154 int total_initial_size_; | 162 int total_initial_size_; |
155 | 163 |
156 // Gives a previews of where the the window will end up. Only used if there | 164 // Gives a previews of where the the window will end up. Only used if there |
157 // is a grid and the caption is being dragged. | 165 // is a grid and the caption is being dragged. |
158 scoped_ptr<PhantomWindowController> phantom_window_controller_; | 166 scoped_ptr<PhantomWindowController> phantom_window_controller_; |
159 | 167 |
| 168 // For now, we show a phantom window on the other root window during dragging. |
| 169 // TODO(yusukes): Show a semi-transparent image (screen shot) of the window |
| 170 // instead. |
| 171 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; |
| 172 |
160 // Used to determine the target position of a snap. | 173 // Used to determine the target position of a snap. |
161 scoped_ptr<SnapSizer> snap_sizer_; | 174 scoped_ptr<SnapSizer> snap_sizer_; |
162 | 175 |
163 // Last SnapType. | 176 // Last SnapType. |
164 SnapType snap_type_; | 177 SnapType snap_type_; |
165 | 178 |
166 // Number of mouse moves since the last bounds change. Only used for phantom | 179 // Number of mouse moves since the last bounds change. Only used for phantom |
167 // placement to track when the mouse is moved while pushed against the edge of | 180 // placement to track when the mouse is moved while pushed against the edge of |
168 // the screen. | 181 // the screen. |
169 int num_mouse_moves_since_bounds_change_; | 182 int num_mouse_moves_since_bounds_change_; |
170 | 183 |
171 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 184 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
172 }; | 185 }; |
173 | 186 |
174 } // namespace internal | 187 } // namespace internal |
175 } // namespace ash | 188 } // namespace ash |
176 | 189 |
177 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 190 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |