OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gfx/point.h" | 10 #include "ui/gfx/point.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); | 58 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); |
59 | 59 |
60 // Returns the dimensions of the primary monitor in pixels. | 60 // Returns the dimensions of the primary monitor in pixels. |
61 static gfx::Size GetPrimaryMonitorSize(); | 61 static gfx::Size GetPrimaryMonitorSize(); |
62 | 62 |
63 // Returns the number of monitors. | 63 // Returns the number of monitors. |
64 // Mirrored displays are excluded; this method is intended to return the | 64 // Mirrored displays are excluded; this method is intended to return the |
65 // number of distinct, usable displays. | 65 // number of distinct, usable displays. |
66 static int GetNumMonitors(); | 66 static int GetNumMonitors(); |
67 | 67 |
68 #if defined(OS_WIN) | |
sky
2012/02/03 18:34:06
I don't like defining this here. Move it into it's
| |
69 // Returns a device context compatible with the screen. The context can be | |
70 // used as a temporary context on the UI thread. | |
71 static HDC GetCompatibleDC(); | |
72 | |
73 // Should be called on WM_DISPLAYCHANGE to release the cached compatible | |
74 // device context, if any. | |
75 static void ReleaseCompatibleDC(); | |
76 #endif | |
77 | |
68 protected: | 78 protected: |
69 virtual gfx::Point GetCursorScreenPointImpl() = 0; | 79 virtual gfx::Point GetCursorScreenPointImpl() = 0; |
70 virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl( | 80 virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl( |
71 gfx::NativeView view) = 0; | 81 gfx::NativeView view) = 0; |
72 virtual gfx::Rect GetMonitorAreaNearestWindowImpl( | 82 virtual gfx::Rect GetMonitorAreaNearestWindowImpl( |
73 gfx::NativeView view) = 0; | 83 gfx::NativeView view) = 0; |
74 virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl( | 84 virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl( |
75 const gfx::Point& point) = 0; | 85 const gfx::Point& point) = 0; |
76 virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0; | 86 virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0; |
77 virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0; | 87 virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0; |
78 virtual gfx::Size GetPrimaryMonitorSizeImpl() = 0; | 88 virtual gfx::Size GetPrimaryMonitorSizeImpl() = 0; |
79 virtual int GetNumMonitorsImpl() = 0; | 89 virtual int GetNumMonitorsImpl() = 0; |
80 | 90 |
81 private: | 91 private: |
82 #if defined(USE_AURA) | 92 #if defined(USE_AURA) |
83 // The singleton screen instance. Only used on aura. | 93 // The singleton screen instance. Only used on aura. |
84 static Screen* instance_; | 94 static Screen* instance_; |
85 #endif | 95 #endif |
96 | |
97 #if defined(OS_WIN) | |
98 // Cached device context compatible with the screen. | |
99 static HDC compatible_dc_; | |
100 #endif | |
86 }; | 101 }; |
87 | 102 |
88 } // namespace gfx | 103 } // namespace gfx |
89 | 104 |
90 #endif // VIEWS_SCREEN_H_ | 105 #endif // VIEWS_SCREEN_H_ |
OLD | NEW |