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_RESIZER_H_ | 5 #ifndef ASH_WM_WINDOW_RESIZER_H_ |
6 #define ASH_WM_WINDOW_RESIZER_H_ | 6 #define ASH_WM_WINDOW_RESIZER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 int bounds_change; | 82 int bounds_change; |
83 | 83 |
84 // Bitmask of the |kBoundsChangeDirection_| constants. | 84 // Bitmask of the |kBoundsChangeDirection_| constants. |
85 int position_change_direction; | 85 int position_change_direction; |
86 | 86 |
87 // Bitmask of the |kBoundsChangeDirection_| constants. | 87 // Bitmask of the |kBoundsChangeDirection_| constants. |
88 int size_change_direction; | 88 int size_change_direction; |
89 | 89 |
90 // Will the drag actually modify the window? | 90 // Will the drag actually modify the window? |
91 bool is_resizable; | 91 bool is_resizable; |
92 | |
93 // Is the drag initiated by a touch action? | |
94 bool is_touch; | |
92 }; | 95 }; |
93 | 96 |
94 static gfx::Rect CalculateBoundsForDrag(const Details& details, | 97 static gfx::Rect CalculateBoundsForDrag(const Details& details, |
95 const gfx::Point& location); | 98 const gfx::Point& location); |
96 | 99 |
97 static gfx::Rect AdjustBoundsToGrid(const gfx::Rect& bounds, | 100 static gfx::Rect AdjustBoundsToGrid(const gfx::Rect& bounds, |
98 int grid_size); | 101 int grid_size); |
99 | 102 |
103 // Adjusts amounts of movement for touch resizes. Normally, the window border | |
104 // being dragged is several pixels behind the finger. This adjustment gives | |
105 // more speed to the window border, such that the border and the finger line | |
106 // up at the edge of the screen. | |
107 static void AdjustDeltas(const Details& details, int* delta_x, int* delta_y); | |
sadrul
2013/05/08 17:10:56
How about:
static gfx::Vector2d AdjustDeltaForTou
mohsen
2013/05/28 23:27:39
delta_x and delta_y are defined as two separate in
| |
108 | |
100 static bool IsBottomEdge(int component); | 109 static bool IsBottomEdge(int component); |
101 | 110 |
102 private: | 111 private: |
103 // Returns the new origin of the window. The arguments are the difference | 112 // Returns the new origin of the window. The arguments are the difference |
104 // between the current location and the initial location. | 113 // between the current location and the initial location. |
105 static gfx::Point GetOriginForDrag(const Details& details, | 114 static gfx::Point GetOriginForDrag(const Details& details, |
106 int delta_x, | 115 int delta_x, |
107 int delta_y); | 116 int delta_y); |
108 | 117 |
109 // Returns the size of the window for the drag. | 118 // Returns the size of the window for the drag. |
(...skipping 15 matching lines...) Expand all Loading... | |
125 // Creates a WindowResizer for |window|. This can return a scoped_ptr | 134 // Creates a WindowResizer for |window|. This can return a scoped_ptr |
126 // initialized with NULL if |window| should not be resized nor dragged. | 135 // initialized with NULL if |window| should not be resized nor dragged. |
127 ASH_EXPORT scoped_ptr<WindowResizer> CreateWindowResizer( | 136 ASH_EXPORT scoped_ptr<WindowResizer> CreateWindowResizer( |
128 aura::Window* window, | 137 aura::Window* window, |
129 const gfx::Point& point_in_parent, | 138 const gfx::Point& point_in_parent, |
130 int window_component); | 139 int window_component); |
131 | 140 |
132 } // namespace aura | 141 } // namespace aura |
133 | 142 |
134 #endif // ASH_WM_WINDOW_RESIZER_H_ | 143 #endif // ASH_WM_WINDOW_RESIZER_H_ |
OLD | NEW |