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
{
20 ~ScreenWin() override
;
23 // Overridden from gfx::Screen:
24 gfx::Point
GetCursorScreenPoint() override
;
25 gfx::NativeWindow
GetWindowUnderCursor() override
;
26 gfx::NativeWindow
GetWindowAtScreenPoint(const gfx::Point
& point
) override
;
27 int GetNumDisplays() const override
;
28 std::vector
<gfx::Display
> GetAllDisplays() const override
;
29 gfx::Display
GetDisplayNearestWindow(gfx::NativeView window
) const override
;
30 gfx::Display
GetDisplayNearestPoint(const gfx::Point
& point
) const override
;
31 gfx::Display
GetDisplayMatching(const gfx::Rect
& match_rect
) const override
;
32 gfx::Display
GetPrimaryDisplay() const override
;
33 void AddObserver(DisplayObserver
* observer
) override
;
34 void RemoveObserver(DisplayObserver
* observer
) override
;
36 // Overriden from gfx::SingletonHwnd::Observer.
37 void OnWndProc(HWND hwnd
,
40 LPARAM lparam
) override
;
42 // Returns the HWND associated with the NativeView.
43 virtual HWND
GetHWNDFromNativeView(NativeView window
) const;
45 // Returns the NativeView associated with the HWND.
46 virtual NativeWindow
GetNativeWindowFromHWND(HWND hwnd
) const;
49 // Helper implementing the DisplayObserver handling.
50 gfx::DisplayChangeNotifier change_notifier_
;
52 // Current list of displays.
53 std::vector
<gfx::Display
> displays_
;
55 DISALLOW_COPY_AND_ASSIGN(ScreenWin
);
60 #endif // UI_GFX_SCREEN_WIN_H_