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_WM_CORE_EASY_RESIZE_WINDOW_TARGETER_H_
6 #define UI_WM_CORE_EASY_RESIZE_WINDOW_TARGETER_H_
8 #include "ui/aura/window_targeter.h"
9 #include "ui/gfx/geometry/insets.h"
10 #include "ui/wm/core/wm_core_export.h"
14 // An EventTargeter for a container window that uses a slightly larger
15 // hit-target region for easier resize.
16 class WM_CORE_EXPORT EasyResizeWindowTargeter : public aura::WindowTargeter {
18 // |container| window is the owner of this targeter.
19 EasyResizeWindowTargeter(aura::Window* container,
20 const gfx::Insets& mouse_extend,
21 const gfx::Insets& touch_extend);
23 virtual ~EasyResizeWindowTargeter();
26 void set_mouse_extend(const gfx::Insets& mouse_extend) {
27 mouse_extend_ = mouse_extend;
30 void set_touch_extend(const gfx::Insets& touch_extend) {
31 touch_extend_ = touch_extend;
34 // aura::WindowTargeter:
35 virtual bool EventLocationInsideBounds(
37 const ui::LocatedEvent& event) const OVERRIDE;
40 // Returns true if the hit testing (EventLocationInsideBounds()) should use
41 // the extended bounds.
42 bool ShouldUseExtendedBounds(const aura::Window* window) const;
44 aura::Window* container_;
45 gfx::Insets mouse_extend_;
46 gfx::Insets touch_extend_;
48 DISALLOW_COPY_AND_ASSIGN(EasyResizeWindowTargeter);
53 #endif // UI_WM_CORE_EASY_RESIZE_WINDOW_TARGETER_H_