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 "base/memory/scoped_ptr.h"
10 #include "ui/gfx/display_change_notifier.h"
11 #include "ui/gfx/gfx_export.h"
12 #include "ui/gfx/screen.h"
13 #include "ui/gfx/win/singleton_hwnd_observer.h"
17 class GFX_EXPORT ScreenWin
: public Screen
{
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 // Returns the HWND associated with the NativeView.
37 virtual HWND
GetHWNDFromNativeView(NativeView window
) const;
39 // Returns the NativeView associated with the HWND.
40 virtual NativeWindow
GetNativeWindowFromHWND(HWND hwnd
) const;
43 void OnWndProc(HWND hwnd
, UINT message
, WPARAM wparam
, LPARAM lparam
);
45 // Helper implementing the DisplayObserver handling.
46 gfx::DisplayChangeNotifier change_notifier_
;
48 scoped_ptr
<SingletonHwndObserver
> singleton_hwnd_observer_
;
50 // Current list of displays.
51 std::vector
<gfx::Display
> displays_
;
53 DISALLOW_COPY_AND_ASSIGN(ScreenWin
);
58 #endif // UI_GFX_SCREEN_WIN_H_