Chromium Code Reviews| 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" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 | 14 |
| 15 // A utility class for getting various info about screen size, monitors, | 15 // A utility class for getting various info about screen size, monitors, |
| 16 // cursor position, etc. | 16 // cursor position, etc. |
| 17 // TODO(erikkay) add more of those methods here | 17 // TODO(erikkay) add more of those methods here |
| 18 class UI_EXPORT Screen { | 18 class UI_EXPORT Screen { |
| 19 public: | 19 public: |
| 20 virtual ~Screen() {} | |
| 21 | |
| 22 #if defined(USE_AURA) | |
| 23 // Sets the instance to use. This takes owernship of |screen|, deleting the | |
| 24 // old instant. This is used on aura to avoid circular dependencies between ui | |
|
Ben Goodger (Google)
2011/10/08 00:57:32
instance
| |
| 25 // and aura. | |
| 26 static void SetInstance(Screen* screen); | |
| 27 #endif | |
| 28 | |
| 20 static gfx::Point GetCursorScreenPoint(); | 29 static gfx::Point GetCursorScreenPoint(); |
| 21 | 30 |
| 22 // Returns the work area of the monitor nearest the specified window. | 31 // Returns the work area of the monitor nearest the specified window. |
| 23 static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view); | 32 static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view); |
| 24 | 33 |
| 25 // Returns the bounds of the monitor nearest the specified window. | 34 // Returns the bounds of the monitor nearest the specified window. |
| 26 static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view); | 35 static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view); |
| 27 | 36 |
| 28 // Returns the work area of the monitor nearest the specified point. | 37 // Returns the work area of the monitor nearest the specified point. |
| 29 static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point); | 38 static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point); |
| 30 | 39 |
| 31 // Returns the monitor area (not the work area, but the complete bounds) of | 40 // Returns the monitor area (not the work area, but the complete bounds) of |
| 32 // the monitor nearest the specified point. | 41 // the monitor nearest the specified point. |
| 33 static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point); | 42 static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point); |
| 34 | 43 |
| 35 // Returns the window under the cursor. | 44 // Returns the window under the cursor. |
| 36 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); | 45 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); |
| 46 | |
| 47 protected: | |
| 48 virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl( | |
| 49 gfx::NativeView view) = 0; | |
| 50 virtual gfx::Rect GetMonitorAreaNearestWindowImpl( | |
| 51 gfx::NativeView view) = 0; | |
| 52 virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl( | |
| 53 const gfx::Point& point) = 0; | |
| 54 virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0; | |
| 55 virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0; | |
| 56 | |
| 57 private: | |
| 58 #if defined(USE_AURA) | |
| 59 // The singleton screen instance. Only used on aura. | |
| 60 static Screen* instance_; | |
| 61 #endif | |
| 37 }; | 62 }; |
| 38 | 63 |
| 39 } // namespace gfx | 64 } // namespace gfx |
| 40 | 65 |
| 41 #endif // VIEWS_SCREEN_H_ | 66 #endif // VIEWS_SCREEN_H_ |
| OLD | NEW |