Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(682)

Side by Side Diff: ui/gfx/screen.h

Issue 8382019: Move DisplayUtils methods into gfx::Screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove DCHECKS Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "ui/gfx/size.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 15
15 // A utility class for getting various info about screen size, monitors, 16 // A utility class for getting various info about screen size, monitors,
16 // cursor position, etc. 17 // cursor position, etc.
17 // TODO(erikkay) add more of those methods here 18 // TODO(erikkay) add more of those methods here
18 class UI_EXPORT Screen { 19 class UI_EXPORT Screen {
19 public: 20 public:
20 virtual ~Screen() {} 21 virtual ~Screen() {}
21 22
22 #if defined(USE_AURA) 23 #if defined(USE_AURA)
23 // 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
24 // 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
25 // ui and aura. 26 // ui and aura.
26 static void SetInstance(Screen* screen); 27 static void SetInstance(Screen* screen);
27 #endif 28 #endif
28 29
30 // Returns the current absolute position of the mouse pointer.
29 static gfx::Point GetCursorScreenPoint(); 31 static gfx::Point GetCursorScreenPoint();
30 32
31 // Returns the work area of the monitor nearest the specified window. 33 // Returns the work area of the monitor nearest the specified window.
32 static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view); 34 static gfx::Rect GetMonitorWorkAreaNearestWindow(gfx::NativeView view);
33 35
34 // Returns the bounds of the monitor nearest the specified window. 36 // Returns the bounds of the monitor nearest the specified window.
35 static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view); 37 static gfx::Rect GetMonitorAreaNearestWindow(gfx::NativeView view);
36 38
37 // Returns the work area of the monitor nearest the specified point. 39 // Returns the work area of the monitor nearest the specified point.
38 static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point); 40 static gfx::Rect GetMonitorWorkAreaNearestPoint(const gfx::Point& point);
39 41
40 // Returns the monitor area (not the work area, but the complete bounds) of 42 // Returns the monitor area (not the work area, but the complete bounds) of
41 // the monitor nearest the specified point. 43 // the monitor nearest the specified point.
42 static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point); 44 static gfx::Rect GetMonitorAreaNearestPoint(const gfx::Point& point);
43 45
44 // Returns the window under the cursor. 46 // Returns the window under the cursor.
45 static gfx::NativeWindow GetWindowAtCursorScreenPoint(); 47 static gfx::NativeWindow GetWindowAtCursorScreenPoint();
46 48
49 // Returns the dimensions of the primary monitor in pixels.
50 static gfx::Size GetPrimaryMonitorSize();
51
52 // Returns the number of monitors.
53 // Mirrored displays are excluded; this method is intended to return the
54 // number of distinct, usable displays.
55 static int GetNumMonitors();
56
47 protected: 57 protected:
48 virtual gfx::Point GetCursorScreenPointImpl() = 0; 58 virtual gfx::Point GetCursorScreenPointImpl() = 0;
49 virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl( 59 virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl(
50 gfx::NativeView view) = 0; 60 gfx::NativeView view) = 0;
51 virtual gfx::Rect GetMonitorAreaNearestWindowImpl( 61 virtual gfx::Rect GetMonitorAreaNearestWindowImpl(
52 gfx::NativeView view) = 0; 62 gfx::NativeView view) = 0;
53 virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl( 63 virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl(
54 const gfx::Point& point) = 0; 64 const gfx::Point& point) = 0;
55 virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0; 65 virtual gfx::Rect GetMonitorAreaNearestPointImpl(const gfx::Point& point) = 0;
56 virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0; 66 virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() = 0;
67 virtual gfx::Size GetPrimaryMonitorSizeImpl() = 0;
68 virtual int GetNumMonitorsImpl() = 0;
57 69
58 private: 70 private:
59 #if defined(USE_AURA) 71 #if defined(USE_AURA)
60 // The singleton screen instance. Only used on aura. 72 // The singleton screen instance. Only used on aura.
61 static Screen* instance_; 73 static Screen* instance_;
62 #endif 74 #endif
63 }; 75 };
64 76
65 } // namespace gfx 77 } // namespace gfx
66 78
67 #endif // VIEWS_SCREEN_H_ 79 #endif // VIEWS_SCREEN_H_
OLDNEW
« no previous file with comments | « ui/aura/screen_aura.cc ('k') | ui/gfx/screen_aura.cc » ('j') | ui/ui_unittests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698