From 3b66a3cddaa01576269a60803b0d9313d21a78f4 Mon Sep 17 00:00:00 2001 From: "sadrul@chromium.org" Date: Mon, 6 Jan 2014 22:00:30 +0000 Subject: aura: Add an EasyResizeWindowTargeter. Add EasyResizeWindowTargeter to allow easily resizing windows with mouse/touch with the new event-dispatch code. This will eventually allow getting rid of Window::SetHitTestBoundsOverrideOuter() once the new event-dispatch code is used for all event types. This patch installs an EasyResizeWindowTargeter for the shelf and status-area widgets. Subsequent CLs will install such targeters for the toplevel windows too. Collateral change includes adding some dependencies on wm_public (in DEPS and gyp). BUG=318879 R=ben@chromium.org Review URL: https://codereview.chromium.org/118553004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243177 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/wm/public/easy_resize_window_targeter.h | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ui/wm/public/easy_resize_window_targeter.h (limited to 'ui/wm/public') diff --git a/ui/wm/public/easy_resize_window_targeter.h b/ui/wm/public/easy_resize_window_targeter.h new file mode 100644 index 0000000..c4c7137 --- /dev/null +++ b/ui/wm/public/easy_resize_window_targeter.h @@ -0,0 +1,48 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ +#define UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ + +#include "ui/aura/window_targeter.h" +#include "ui/gfx/geometry/insets.h" + +namespace wm { + +// An EventTargeter for a container window that uses a slightly larger +// hit-target region for easier resize. +class EasyResizeWindowTargeter : public aura::WindowTargeter { + public: + // |container| window is the owner of this targeter. + EasyResizeWindowTargeter(aura::Window* container, + const gfx::Insets& mouse_extend, + const gfx::Insets& touch_extend); + + virtual ~EasyResizeWindowTargeter(); + + protected: + void set_mouse_extend(const gfx::Insets& mouse_extend) { + mouse_extend_ = mouse_extend; + } + + void set_touch_extend(const gfx::Insets& touch_extend) { + touch_extend_ = touch_extend; + } + + // aura::WindowTargeter: + virtual bool EventLocationInsideBounds( + aura::Window* window, + const ui::LocatedEvent& event) const OVERRIDE; + + private: + aura::Window* container_; + gfx::Insets mouse_extend_; + gfx::Insets touch_extend_; + + DISALLOW_COPY_AND_ASSIGN(EasyResizeWindowTargeter); +}; + +} // namespace wm + +#endif // UI_WM_PUBLIC_EASY_RESIZE_WINDOW_TARGETER_H_ -- cgit v1.1