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
3 // found in the LICENSE file.
5 #ifndef UI_GFX_SCREEN_WIN_H_
6 #define UI_GFX_SCREEN_WIN_H_
8 #include "base/compiler_specific.h"
9 #include "ui/gfx/display_change_notifier.h"
10 #include "ui/gfx/gfx_export.h"
11 #include "ui/gfx/screen.h"
12 #include "ui/gfx/win/singleton_hwnd.h"
16 class GFX_EXPORT ScreenWin
: public Screen
,
17 public SingletonHwnd::Observer
{
23 // Overridden from gfx::Screen:
24 virtual bool IsDIPEnabled() OVERRIDE
;
25 virtual gfx::Point
GetCursorScreenPoint() OVERRIDE
;
26 virtual gfx::NativeWindow
GetWindowUnderCursor() OVERRIDE
;
27 virtual gfx::NativeWindow
GetWindowAtScreenPoint(const gfx::Point
& point
)
29 virtual int GetNumDisplays() const OVERRIDE
;
30 virtual std::vector
<gfx::Display
> GetAllDisplays() const OVERRIDE
;
31 virtual gfx::Display
GetDisplayNearestWindow(
32 gfx::NativeView window
) const OVERRIDE
;
33 virtual gfx::Display
GetDisplayNearestPoint(
34 const gfx::Point
& point
) const OVERRIDE
;
35 virtual gfx::Display
GetDisplayMatching(
36 const gfx::Rect
& match_rect
) const OVERRIDE
;
37 virtual gfx::Display
GetPrimaryDisplay() const OVERRIDE
;
38 virtual void AddObserver(DisplayObserver
* observer
) OVERRIDE
;
39 virtual void RemoveObserver(DisplayObserver
* observer
) OVERRIDE
;
41 // Overriden from gfx::SingletonHwnd::Observer.
42 virtual void OnWndProc(HWND hwnd
,
45 LPARAM lparam
) OVERRIDE
;
47 // Returns the HWND associated with the NativeView.
48 virtual HWND
GetHWNDFromNativeView(NativeView window
) const;
50 // Returns the NativeView associated with the HWND.
51 virtual NativeWindow
GetNativeWindowFromHWND(HWND hwnd
) const;
54 // Helper implementing the DisplayObserver handling.
55 gfx::DisplayChangeNotifier change_notifier_
;
57 // Current list of displays.
58 std::vector
<gfx::Display
> displays_
;
60 DISALLOW_COPY_AND_ASSIGN(ScreenWin
);
65 #endif // UI_GFX_SCREEN_WIN_H_