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 CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // passed input position is only used to retrieve the width and height. | 24 // passed input position is only used to retrieve the width and height. |
25 // The position is determined on the left / right / top / bottom first. If | 25 // The position is determined on the left / right / top / bottom first. If |
26 // no smart space is found, the position will follow the standard what other | 26 // no smart space is found, the position will follow the standard what other |
27 // operating systems do (default cascading style). | 27 // operating systems do (default cascading style). |
28 gfx::Rect GetPopupPosition(const gfx::Rect& old_pos); | 28 gfx::Rect GetPopupPosition(const gfx::Rect& old_pos); |
29 | 29 |
30 protected: | 30 protected: |
31 // Find a smart way to position the popup window. If there is no space this | 31 // Find a smart way to position the popup window. If there is no space this |
32 // function will return an empty rectangle. | 32 // function will return an empty rectangle. |
33 gfx::Rect SmartPopupPosition(const gfx::Rect& old_pos, | 33 gfx::Rect SmartPopupPosition(const gfx::Rect& old_pos, |
34 const gfx::Rect& work_space); | 34 const gfx::Rect& work_area, |
| 35 int grid); |
35 | 36 |
36 // Find the next available cascading popup position (on the given screen). | 37 // Find the next available cascading popup position (on the given screen). |
37 gfx::Rect NormalPopupPosition(const gfx::Rect& old_pos, | 38 gfx::Rect NormalPopupPosition(const gfx::Rect& old_pos, |
38 const gfx::Rect& work_space); | 39 const gfx::Rect& work_area); |
| 40 |
| 41 // Align the location to the grid / snap to the right / bottom corner. |
| 42 gfx::Rect AlignPopupPosition(const gfx::Rect &pos, |
| 43 const gfx::Rect &work_area, |
| 44 int grid); |
39 | 45 |
40 // Constants to identify the type of resize. | 46 // Constants to identify the type of resize. |
41 static const int kBoundsChange_None; | 47 static const int kBoundsChange_None; |
42 | 48 |
43 // The offset in X and Y for the next popup which opens. | 49 // The offset in X and Y for the next popup which opens. |
44 int pop_position_offset_increment_x; | 50 int pop_position_offset_increment_x; |
45 int pop_position_offset_increment_y; | 51 int pop_position_offset_increment_y; |
46 | 52 |
47 // The position on the screen for the first popup which gets shown if no | 53 // The position on the screen for the first popup which gets shown if no |
48 // empty space can be found. | 54 // empty space can be found. |
49 int popup_position_offset_from_screen_corner_x; | 55 int popup_position_offset_from_screen_corner_x; |
50 int popup_position_offset_from_screen_corner_y; | 56 int popup_position_offset_from_screen_corner_y; |
51 | 57 |
52 // The last used position. | 58 // The last used position. |
53 int last_popup_position_x_; | 59 int last_popup_position_x_; |
54 int last_popup_position_y_; | 60 int last_popup_position_y_; |
55 | 61 |
56 DISALLOW_COPY_AND_ASSIGN(WindowPositioner); | 62 DISALLOW_COPY_AND_ASSIGN(WindowPositioner); |
57 }; | 63 }; |
58 | 64 |
59 #endif // CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_ASH_WINDOW_POSITIONER_H_ |
OLD | NEW |