Chromium Code Reviews| 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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
| 12 #include "ui/gfx/geometry/point.h" | 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/gfx_export.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/screen_type_delegate.h" | |
| 16 | 15 |
| 17 namespace gfx { | 16 namespace gfx { |
| 18 class DisplayObserver; | 17 class DisplayObserver; |
| 19 class Rect; | 18 class Rect; |
| 20 | 19 |
| 21 // A utility class for getting various info about screen size, displays, | 20 // A utility class for getting various info about screen size, displays, |
| 22 // cursor position, etc. | 21 // cursor position, etc. |
| 23 // | 22 // |
| 24 // Note that this class does not represent an individual display connected to a | 23 // Note that this class does not represent an individual display connected to a |
| 25 // computer -- see the Display class for that. A single Screen object exists on | 24 // computer -- see the Display class for that. A single Screen object exists |
| 26 // most operating systems regardless of the number of connected displays. On | 25 // regardless of the number of connected displays. |
| 27 // Windows 8, two Screens exist: one for Metro UI and another for the desktop. | |
| 28 class GFX_EXPORT Screen { | 26 class GFX_EXPORT Screen { |
| 29 public: | 27 public: |
| 30 // Retrieves the Screen that the specified NativeView belongs to. A value of | 28 // Retrieves the single Screen object. |
|
sky
2016/01/19 22:47:55
nit: constructor/destructor before static function
scottmg
2016/01/20 00:52:57
Done.
| |
| 31 // NULL is treated as |SCREEN_TYPE_NATIVE|. | 29 static Screen* GetScreen(); |
| 32 static Screen* GetScreenFor(NativeView view); | |
| 33 | 30 |
| 34 // Returns the SCREEN_TYPE_NATIVE Screen. This should be used with caution, | 31 // Sets the global screen. NOTE: this does not take ownership of |screen|. |
| 35 // as it is likely to be incorrect for code that runs on Windows. | 32 // Tests must be sure to reset any state they install. |
| 36 static Screen* GetNativeScreen(); | 33 static void SetScreenInstance(Screen* instance); |
| 37 | |
| 38 // Sets the global screen for a particular screen type. Only the _NATIVE | |
| 39 // ScreenType must be provided. | |
| 40 // NOTE: this does not take ownership of |screen|. Tests must be sure to | |
| 41 // reset any state they install. | |
| 42 static void SetScreenInstance(ScreenType type, Screen* instance); | |
| 43 | |
| 44 // Returns the global screen for a particular type. Types other than _NATIVE | |
| 45 // may be NULL. | |
| 46 static Screen* GetScreenByType(ScreenType type); | |
| 47 | |
| 48 // Sets the global ScreenTypeDelegate. May be left unset if the platform | |
| 49 // uses only the _NATIVE ScreenType. | |
| 50 // NOTE: this does not take ownership of |delegate|. Tests must be sure to | |
| 51 // reset any state they install. | |
| 52 static void SetScreenTypeDelegate(ScreenTypeDelegate* delegate); | |
| 53 | 34 |
| 54 Screen(); | 35 Screen(); |
| 55 virtual ~Screen(); | 36 virtual ~Screen(); |
| 56 | 37 |
| 57 // Returns the current absolute position of the mouse pointer. | 38 // Returns the current absolute position of the mouse pointer. |
| 58 virtual gfx::Point GetCursorScreenPoint() = 0; | 39 virtual gfx::Point GetCursorScreenPoint() = 0; |
| 59 | 40 |
| 60 // Returns the window under the cursor. | 41 // Returns the window under the cursor. |
| 61 virtual gfx::NativeWindow GetWindowUnderCursor() = 0; | 42 virtual gfx::NativeWindow GetWindowUnderCursor() = 0; |
| 62 | 43 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 93 | 74 |
| 94 private: | 75 private: |
| 95 DISALLOW_COPY_AND_ASSIGN(Screen); | 76 DISALLOW_COPY_AND_ASSIGN(Screen); |
| 96 }; | 77 }; |
| 97 | 78 |
| 98 Screen* CreateNativeScreen(); | 79 Screen* CreateNativeScreen(); |
| 99 | 80 |
| 100 } // namespace gfx | 81 } // namespace gfx |
| 101 | 82 |
| 102 #endif // UI_GFX_SCREEN_H_ | 83 #endif // UI_GFX_SCREEN_H_ |
| OLD | NEW |