15f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
25f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// found in the LICENSE file.
45f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#ifndef UI_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_
65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#define UI_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_
75f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
85f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "base/compiler_specific.h"
95f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/gfx/win/window_impl.h"
105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/platform_window/platform_window.h"
115f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "ui/platform_window/win/win_window_export.h"
125f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
135f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace ui {
145f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
155f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)class WIN_WINDOW_EXPORT WinWindow : public NON_EXPORTED_BASE(PlatformWindow),
165f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                                    public gfx::WindowImpl {
175f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) public:
185f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  WinWindow(PlatformWindowDelegate* delegate, const gfx::Rect& bounds);
195f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual ~WinWindow();
205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) private:
225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void Destroy();
235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // PlatformWindow:
255f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Show() OVERRIDE;
265f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Hide() OVERRIDE;
275f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Close() OVERRIDE;
285f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
295f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual gfx::Rect GetBounds() OVERRIDE;
305f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void SetCapture() OVERRIDE;
315f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void ReleaseCapture() OVERRIDE;
325f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void ToggleFullscreen() OVERRIDE;
335f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Maximize() OVERRIDE;
345f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Minimize() OVERRIDE;
355f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void Restore() OVERRIDE;
365f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void SetCursor(PlatformCursor cursor) OVERRIDE;
375f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
385f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
395f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  CR_BEGIN_MSG_MAP_EX(WinWindow)
405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange)
415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE,
425f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                                WM_NCXBUTTONDBLCLK,
435f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                                OnMouseRange)
445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_CAPTURECHANGED, OnCaptureChanged)
455f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
465f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_KEYDOWN, OnKeyEvent)
475f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_KEYUP, OnKeyEvent)
485f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_SYSKEYDOWN, OnKeyEvent)
495f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_SYSKEYUP, OnKeyEvent)
505f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_CHAR, OnKeyEvent)
515f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_SYSCHAR, OnKeyEvent)
525f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_IME_CHAR, OnKeyEvent)
535f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
545f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
555f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MSG_WM_CLOSE(OnClose)
565f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MSG_WM_CREATE(OnCreate)
575f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MSG_WM_DESTROY(OnDestroy)
585f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MSG_WM_PAINT(OnPaint)
595f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)    CR_MSG_WM_WINDOWPOSCHANGED(OnWindowPosChanged)
605f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  CR_END_MSG_MAP()
615f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
625f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
635f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  LRESULT OnCaptureChanged(UINT message, WPARAM w_param, LPARAM l_param);
645f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  LRESULT OnKeyEvent(UINT message, WPARAM w_param, LPARAM l_param);
655f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param);
665f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void OnClose();
675f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  LRESULT OnCreate(CREATESTRUCT* create_struct);
685f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void OnDestroy();
695f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void OnPaint(HDC);
705f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void OnWindowPosChanged(WINDOWPOS* window_pos);
715f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
725f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  PlatformWindowDelegate* delegate_;
735f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
745f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(WinWindow);
755f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)};
765f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
775f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)namespace test {
785f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
795f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// Set true to let WindowTreeHostWin use a popup window
805f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// with no frame/title so that the window size and test's
815f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)// expectations matches.
825f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)WIN_WINDOW_EXPORT void SetUsePopupAsRootWindowForTest(bool use);
835f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
845f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace test
855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)}  // namespace ui
875f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
885f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif  // UI_PLATFORM_WINDOW_WIN_WIN_WINDOW_H_
89