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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // |grid_size|. | 41 // |grid_size|. |
42 static int AlignToGrid(int location, int grid_size); | 42 static int AlignToGrid(int location, int grid_size); |
43 | 43 |
44 // Variant of AlignToGrid that rounds up. | 44 // Variant of AlignToGrid that rounds up. |
45 static int AlignToGridRoundUp(int location, int grid_size); | 45 static int AlignToGridRoundUp(int location, int grid_size); |
46 | 46 |
47 // Variant of AlignToGrid that rounds down. | 47 // Variant of AlignToGrid that rounds down. |
48 static int AlignToGridRoundDown(int location, int grid_size); | 48 static int AlignToGridRoundDown(int location, int grid_size); |
49 | 49 |
50 // Invoked to drag/move/resize the window. |location| is in the coordinates | 50 // Invoked to drag/move/resize the window. |location| is in the coordinates |
51 // of the window supplied to the constructor. | 51 // of the window supplied to the constructor. |event_flags| is the event |
52 virtual void Drag(const gfx::Point& location) = 0; | 52 // flags from mouse event. |
| 53 virtual void Drag(const gfx::Point& location, int event_flags) = 0; |
53 | 54 |
54 // Invoked to complete the drag. | 55 // Invoked to complete the drag. |
55 virtual void CompleteDrag() = 0; | 56 virtual void CompleteDrag() = 0; |
56 | 57 |
57 // Reverts the drag. | 58 // Reverts the drag. |
58 virtual void RevertDrag() = 0; | 59 virtual void RevertDrag() = 0; |
59 | 60 |
60 protected: | 61 protected: |
61 struct Details { | 62 struct Details { |
62 Details(); | 63 Details(); |
(...skipping 26 matching lines...) Expand all Loading... |
89 | 90 |
90 // Will the drag actually modify the window? | 91 // Will the drag actually modify the window? |
91 bool is_resizable; | 92 bool is_resizable; |
92 | 93 |
93 // Size of the grid. | 94 // Size of the grid. |
94 int grid_size; | 95 int grid_size; |
95 }; | 96 }; |
96 | 97 |
97 static gfx::Rect CalculateBoundsForDrag( | 98 static gfx::Rect CalculateBoundsForDrag( |
98 const Details& details, | 99 const Details& details, |
99 const gfx::Point& location); | 100 const gfx::Point& location, |
| 101 bool disable_snap_to_grid); |
100 | 102 |
101 static gfx::Rect AdjustBoundsToGrid(const gfx::Rect& bounds, | 103 static gfx::Rect AdjustBoundsToGrid(const gfx::Rect& bounds, |
102 int grid_size); | 104 int grid_size); |
103 | 105 |
104 static bool IsBottomEdge(int component); | 106 static bool IsBottomEdge(int component); |
105 | 107 |
106 private: | 108 private: |
107 // Returns the new origin of the window. The arguments are the difference | 109 // Returns the new origin of the window. The arguments are the difference |
108 // between the current location and the initial location. | 110 // between the current location and the initial location. |
109 static gfx::Point GetOriginForDrag(const Details& details, | 111 static gfx::Point GetOriginForDrag(const Details& details, |
110 int delta_x, | 112 int delta_x, |
111 int delta_y); | 113 int delta_y); |
112 | 114 |
113 // Returns the size of the window for the drag. | 115 // Returns the size of the window for the drag. |
114 static gfx::Size GetSizeForDrag(const Details& details, | 116 static gfx::Size GetSizeForDrag(const Details& details, |
115 int* delta_x, | 117 int* delta_x, |
116 int* delta_y); | 118 int* delta_y, |
| 119 bool disable_snap_to_grid); |
117 | 120 |
118 // Returns the width of the window. | 121 // Returns the width of the window. |
119 static int GetWidthForDrag(const Details& details, | 122 static int GetWidthForDrag(const Details& details, |
120 int min_width, | 123 int min_width, |
121 int* delta_x); | 124 int* delta_x, |
| 125 bool disable_snap_to_grid); |
122 | 126 |
123 // Returns the height of the drag. | 127 // Returns the height of the drag. |
124 static int GetHeightForDrag(const Details& details, | 128 static int GetHeightForDrag(const Details& details, |
125 int min_height, | 129 int min_height, |
126 int* delta_y); | 130 int* delta_y, |
| 131 bool disable_snap_to_grid); |
127 }; | 132 }; |
128 | 133 |
129 } // namespace aura | 134 } // namespace aura |
130 | 135 |
131 #endif // ASH_WM_WINDOW_RESIZER_H_ | 136 #endif // ASH_WM_WINDOW_RESIZER_H_ |
OLD | NEW |