OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_LIST_APP_LIST_POSITIONER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_POSITIONER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_POSITIONER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_POSITIONER_H_ |
7 | 7 |
8 #include "ui/gfx/display.h" | 8 #include "ui/display/display.h" |
9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
10 | 10 |
11 namespace gfx { | 11 namespace gfx { |
12 class Point; | 12 class Point; |
13 class Rect; | 13 class Rect; |
14 } | 14 } |
15 | 15 |
16 // Helps anchor the App List, onto the shelf (taskbar, dock or similar) or to | 16 // Helps anchor the App List, onto the shelf (taskbar, dock or similar) or to |
17 // the corner of a display. This class does not impose any particular policy for | 17 // the corner of a display. This class does not impose any particular policy for |
18 // when and how to anchor the window. The platform-specific code that uses this | 18 // when and how to anchor the window. The platform-specific code that uses this |
(...skipping 16 matching lines...) Expand all Loading... |
35 SCREEN_CORNER_TOP_LEFT, | 35 SCREEN_CORNER_TOP_LEFT, |
36 SCREEN_CORNER_TOP_RIGHT, | 36 SCREEN_CORNER_TOP_RIGHT, |
37 SCREEN_CORNER_BOTTOM_LEFT, | 37 SCREEN_CORNER_BOTTOM_LEFT, |
38 SCREEN_CORNER_BOTTOM_RIGHT | 38 SCREEN_CORNER_BOTTOM_RIGHT |
39 }; | 39 }; |
40 | 40 |
41 // The |display| pointer is borrowed, and must outlive this object's lifetime. | 41 // The |display| pointer is borrowed, and must outlive this object's lifetime. |
42 // |window_size| is the size of the App List. | 42 // |window_size| is the size of the App List. |
43 // |min_distance_from_edge| is the minimum distance, in pixels, to position | 43 // |min_distance_from_edge| is the minimum distance, in pixels, to position |
44 // the app list from the shelf or edge of screen. | 44 // the app list from the shelf or edge of screen. |
45 AppListPositioner(const gfx::Display& display, | 45 AppListPositioner(const display::Display& display, |
46 const gfx::Size& window_size, | 46 const gfx::Size& window_size, |
47 int min_distance_from_edge); | 47 int min_distance_from_edge); |
48 | 48 |
49 // Subtracts a rectangle from the display's work area. This can be used to | 49 // Subtracts a rectangle from the display's work area. This can be used to |
50 // ensure that the app list does not overlap the shelf, even in situations | 50 // ensure that the app list does not overlap the shelf, even in situations |
51 // where the shelf is considered part of the work area. | 51 // where the shelf is considered part of the work area. |
52 void WorkAreaSubtract(const gfx::Rect& rect); | 52 void WorkAreaSubtract(const gfx::Rect& rect); |
53 | 53 |
54 // Shrinks the display's work area by the given amount on each side. | 54 // Shrinks the display's work area by the given amount on each side. |
55 void WorkAreaInset(int left, int top, int right, int bottom); | 55 void WorkAreaInset(int left, int top, int right, int bottom); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // shelves, this is the horizontal distance. If the cursor is inside the | 96 // shelves, this is the horizontal distance. If the cursor is inside the |
97 // shelf, returns 0. | 97 // shelf, returns 0. |
98 int GetCursorDistanceFromShelf(ScreenEdge shelf_edge, | 98 int GetCursorDistanceFromShelf(ScreenEdge shelf_edge, |
99 const gfx::Point& cursor) const; | 99 const gfx::Point& cursor) const; |
100 | 100 |
101 private: | 101 private: |
102 // Ensures that an anchor point will result in a window that is fully within | 102 // Ensures that an anchor point will result in a window that is fully within |
103 // the work area. Returns the updated anchor point. | 103 // the work area. Returns the updated anchor point. |
104 gfx::Point ClampAnchorPoint(gfx::Point anchor) const; | 104 gfx::Point ClampAnchorPoint(gfx::Point anchor) const; |
105 | 105 |
106 gfx::Display display_; | 106 display::Display display_; |
107 | 107 |
108 // Size of the App List. | 108 // Size of the App List. |
109 gfx::Size window_size_; | 109 gfx::Size window_size_; |
110 | 110 |
111 // The minimum distance, in pixels, to position the app list from the shelf | 111 // The minimum distance, in pixels, to position the app list from the shelf |
112 // or edge of screen. | 112 // or edge of screen. |
113 int min_distance_from_edge_; | 113 int min_distance_from_edge_; |
114 }; | 114 }; |
115 | 115 |
116 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_POSITIONER_H_ | 116 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_POSITIONER_H_ |
OLD | NEW |