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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 int window_component, | 45 int window_component, |
46 const std::vector<aura::Window*>& attached_windows); | 46 const std::vector<aura::Window*>& attached_windows); |
47 | 47 |
48 // Returns true if the drag will result in changing the window in anyway. | 48 // Returns true if the drag will result in changing the window in anyway. |
49 bool is_resizable() const { return details_.is_resizable; } | 49 bool is_resizable() const { return details_.is_resizable; } |
50 | 50 |
51 const gfx::Point& initial_location_in_parent() const { | 51 const gfx::Point& initial_location_in_parent() const { |
52 return details_.initial_location_in_parent; | 52 return details_.initial_location_in_parent; |
53 } | 53 } |
54 | 54 |
55 PhantomWindowController* snap_phantom_window_controller_for_testing() const { | |
sky
2012/08/09 21:57:27
Instead of this, make the test a friend. Or create
Yusuke Sato
2012/08/10 00:30:49
Done.
| |
56 return snap_phantom_window_controller_.get(); | |
57 } | |
58 | |
59 PhantomWindowController* drag_phantom_window_controller_for_testing() const { | |
60 return drag_phantom_window_controller_.get(); | |
61 } | |
62 | |
55 // Overridden from WindowResizer: | 63 // Overridden from WindowResizer: |
56 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; | 64 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
57 virtual void CompleteDrag(int event_flags) OVERRIDE; | 65 virtual void CompleteDrag(int event_flags) OVERRIDE; |
58 virtual void RevertDrag() OVERRIDE; | 66 virtual void RevertDrag() OVERRIDE; |
59 | 67 |
60 private: | 68 private: |
61 WorkspaceWindowResizer(const Details& details, | 69 WorkspaceWindowResizer(const Details& details, |
62 const std::vector<aura::Window*>& attached_windows); | 70 const std::vector<aura::Window*>& attached_windows); |
63 | 71 |
64 private: | 72 private: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 // left/right multi window resize and top/bottom resize. | 116 // left/right multi window resize and top/bottom resize. |
109 int PrimaryAxisSize(const gfx::Size& size) const; | 117 int PrimaryAxisSize(const gfx::Size& size) const; |
110 int PrimaryAxisCoordinate(int x, int y) const; | 118 int PrimaryAxisCoordinate(int x, int y) const; |
111 | 119 |
112 // Updates the bounds of the phantom window for window snapping. | 120 // Updates the bounds of the phantom window for window snapping. |
113 void UpdateSnapPhantomWindow(const gfx::Point& location, | 121 void UpdateSnapPhantomWindow(const gfx::Point& location, |
114 const gfx::Rect& bounds, | 122 const gfx::Rect& bounds, |
115 int grid_size); | 123 int grid_size); |
116 | 124 |
117 // Updates the bounds of the phantom window for window dragging. | 125 // Updates the bounds of the phantom window for window dragging. |
118 void UpdateDragPhantomWindow(const gfx::Rect& bounds); | 126 void UpdateDragPhantomWindow(const gfx::Rect& bounds, bool in_original_root); |
sky
2012/08/09 21:57:27
Document |in_original_root|.
Yusuke Sato
2012/08/10 00:30:49
Done.
| |
119 | 127 |
120 // Restacks the windows z-order position so that one of the windows is at the | 128 // Restacks the windows z-order position so that one of the windows is at the |
121 // top of the z-order, and the rest directly underneath it. | 129 // top of the z-order, and the rest directly underneath it. |
122 void RestackWindows(); | 130 void RestackWindows(); |
123 | 131 |
124 // Returns the SnapType for the specified point. SNAP_NONE is used if no | 132 // Returns the SnapType for the specified point. SNAP_NONE is used if no |
125 // snapping should be used. | 133 // snapping should be used. |
126 SnapType GetSnapType(const gfx::Point& location) const; | 134 SnapType GetSnapType(const gfx::Point& location) const; |
127 | 135 |
128 // Returns true if we should allow the mouse pointer to warp. | 136 // Returns true if we should allow the mouse pointer to warp. |
(...skipping 29 matching lines...) Expand all Loading... | |
158 // Sum of sizes in |min_size_|. | 166 // Sum of sizes in |min_size_|. |
159 int total_min_; | 167 int total_min_; |
160 | 168 |
161 // Sum of the sizes in |initial_size_|. | 169 // Sum of the sizes in |initial_size_|. |
162 int total_initial_size_; | 170 int total_initial_size_; |
163 | 171 |
164 // Gives a previews of where the the window will end up. Only used if there | 172 // Gives a previews of where the the window will end up. Only used if there |
165 // is a grid and the caption is being dragged. | 173 // is a grid and the caption is being dragged. |
166 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; | 174 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; |
167 | 175 |
168 // For now, we show a phantom window on the other root window during dragging. | 176 // Shows a semi-transparent image of the window being dragged. |
169 // TODO(yusukes): Show a semi-transparent image (screen shot) of the window | |
170 // instead. | |
171 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; | 177 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; |
172 | 178 |
173 // Used to determine the target position of a snap. | 179 // Used to determine the target position of a snap. |
174 scoped_ptr<SnapSizer> snap_sizer_; | 180 scoped_ptr<SnapSizer> snap_sizer_; |
175 | 181 |
176 // Last SnapType. | 182 // Last SnapType. |
177 SnapType snap_type_; | 183 SnapType snap_type_; |
178 | 184 |
179 // Number of mouse moves since the last bounds change. Only used for phantom | 185 // Number of mouse moves since the last bounds change. Only used for phantom |
180 // placement to track when the mouse is moved while pushed against the edge of | 186 // placement to track when the mouse is moved while pushed against the edge of |
181 // the screen. | 187 // the screen. |
182 int num_mouse_moves_since_bounds_change_; | 188 int num_mouse_moves_since_bounds_change_; |
183 | 189 |
184 // The mouse location passed to Drag(). | 190 // The mouse location passed to Drag(). |
185 gfx::Point last_mouse_location_; | 191 gfx::Point last_mouse_location_; |
186 | 192 |
187 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 193 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
188 }; | 194 }; |
189 | 195 |
190 } // namespace internal | 196 } // namespace internal |
191 } // namespace ash | 197 } // namespace ash |
192 | 198 |
193 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 199 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |