Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / platform_window / win / win_window.h
blob18fada54ff573e71f72546197eaae746ac4ce8a8
1 // Copyright 2014 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_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_
6 #define UI_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_
8 #include "base/compiler_specific.h"
9 #include "ui/gfx/win/window_impl.h"
10 #include "ui/platform_window/platform_window.h"
11 #include "ui/platform_window/win/win_window_export.h"
13 namespace ui {
15 class WIN_WINDOW_EXPORT WinWindow : public NON_EXPORTED_BASE(PlatformWindow),
16 public gfx::WindowImpl {
17 public:
18 WinWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);
19 virtual ~WinWindow();
21 private:
22 void Destroy();
24 // PlatformWindow:
25 virtual void Show() OVERRIDE;
26 virtual void Hide() OVERRIDE;
27 virtual void Close() OVERRIDE;
28 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
29 virtual gfx::Rect GetBounds() OVERRIDE;
30 virtual void SetCapture() OVERRIDE;
31 virtual void ReleaseCapture() OVERRIDE;
32 virtual void ToggleFullscreen() OVERRIDE;
33 virtual void Maximize() OVERRIDE;
34 virtual void Minimize() OVERRIDE;
35 virtual void Restore() OVERRIDE;
36 virtual void SetCursor(PlatformCursor cursor) OVERRIDE;
37 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
39 CR_BEGIN_MSG_MAP_EX(WinWindow)
40 CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
41 CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
42 WM_NCXBUTTONDBLCLK,
43 OnMouseRange)
44 CR_MESSAGE_HANDLER_EX(WM_CAPTURECHANGED, OnCaptureChanged)
46 CR_MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent)
47 CR_MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent)
48 CR_MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent)
49 CR_MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent)
50 CR_MESSAGE_HANDLER_EX(WM_CHAR, OnKeyEvent)
51 CR_MESSAGE_HANDLER_EX(WM_SYSCHAR, OnKeyEvent)
52 CR_MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent)
53 CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
55 CR_MSG_WM_CLOSE(OnClose)
56 CR_MSG_WM_CREATE(OnCreate)
57 CR_MSG_WM_DESTROY(OnDestroy)
58 CR_MSG_WM_PAINT(OnPaint)
59 CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged)
60 CR_END_MSG_MAP()
62 LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
63 LRESULT OnCaptureChanged(UINT message, WPARAM w_param, LPARAM l_param);
64 LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param);
65 LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param);
66 void OnClose();
67 LRESULT OnCreate(CREATESTRUCT* create_struct);
68 void OnDestroy();
69 void OnPaint(HDC);
70 void OnWindowPosChanged(WINDOWPOS* window_pos);
72 PlatformWindowDelegate* delegate_;
74 DISALLOW_COPY_AND_ASSIGN(WinWindow);
77 namespace test {
79 // Set true to let WindowTreeHostWin use a popup window
80 // with no frame/title so that the window size and test's
81 // expectations matches.
82 WIN_WINDOW_EXPORT void SetUsePopupAsRootWindowForTest(bool use);
84 } // namespace test
86 } // namespace ui
88 #endif // UI_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_