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 UI_GFX_SCREEN_H_ | 5 #ifndef UI_GFX_SCREEN_H_ |
6 #define UI_GFX_SCREEN_H_ | 6 #define UI_GFX_SCREEN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/basictypes.h" |
9 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
10 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 class Rect; | 16 class Rect; |
16 class ScreenImpl; | 17 class ScreenImpl; |
17 | 18 |
18 // A utility class for getting various info about screen size, monitors, | 19 // A utility class for getting various info about screen size, displays, |
19 // cursor position, etc. | 20 // cursor position, etc. |
20 class UI_EXPORT Screen { | 21 class UI_EXPORT Screen { |
21 public: | 22 public: |
22 virtual ~Screen() {} | |
23 | |
24 #if defined(USE_AURA) | 23 #if defined(USE_AURA) |
25 // Sets the instance to use. This takes owernship of |screen|, deleting the | 24 // Sets the instance to use. This takes owernship of |screen|, deleting the |
26 // old instance. This is used on aura to avoid circular dependencies between | 25 // old instance. This is used on aura to avoid circular dependencies between |
27 // ui and aura. | 26 // ui and aura. |
28 static void SetInstance(ScreenImpl* screen); | 27 static void SetInstance(ScreenImpl* screen); |
29 #endif | 28 #endif |
30 | 29 |
31 // Returns true if DIP is enabled. | 30 // Returns true if DIP is enabled. |
32 static bool IsDIPEnabled(); | 31 static bool IsDIPEnabled(); |
33 | 32 |
34 // Returns the current absolute position of the mouse pointer. | 33 // Returns the current absolute position of the mouse pointer. |
35 static gfx::Point GetCursorScreenPoint(); | 34 static gfx::Point GetCursorScreenPoint(); |
36 | 35 |
37 // Returns the window under the cursor. | 36 // Returns the window under the cursor. |
38 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); | 37 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); |
39 | 38 |
40 // Returns the number of monitors. | 39 // Returns the number of displays. |
41 // Mirrored displays are excluded; this method is intended to return the | 40 // Mirrored displays are excluded; this method is intended to return the |
42 // number of distinct, usable displays. | 41 // number of distinct, usable displays. |
43 static int GetNumMonitors(); | 42 static int GetNumDisplays(); |
44 | 43 |
45 // Returns the display nearest the specified window. | 44 // Returns the display nearest the specified window. |
46 static gfx::Display GetMonitorNearestWindow(gfx::NativeView view); | 45 static gfx::Display GetDisplayNearestWindow(gfx::NativeView view); |
47 | 46 |
48 // Returns the the display nearest the specified point. | 47 // Returns the the display nearest the specified point. |
49 static gfx::Display GetMonitorNearestPoint(const gfx::Point& point); | 48 static gfx::Display GetDisplayNearestPoint(const gfx::Point& point); |
50 | 49 |
51 // Returns the bounds of the work area of the primary monitor. | 50 // Returns the bounds of the work area of the primary display. |
52 static gfx::Display GetPrimaryMonitor(); | 51 static gfx::Display GetPrimaryDisplay(); |
53 | 52 |
54 // Returns the display that most closely intersects the provided bounds. | 53 // Returns the display that most closely intersects the provided bounds. |
55 static gfx::Display GetMonitorMatching(const gfx::Rect& match_rect); | 54 static gfx::Display GetDisplayMatching(const gfx::Rect& match_rect); |
| 55 |
| 56 private: |
| 57 DISALLOW_IMPLICIT_CONSTRUCTORS(Screen); |
56 }; | 58 }; |
57 | 59 |
58 } // namespace gfx | 60 } // namespace gfx |
59 | 61 |
60 #endif // VIEWS_SCREEN_H_ | 62 #endif // UI_GFX_SCREEN_H_ |
OLD | NEW |