summaryrefslogtreecommitdiffstats
path: root/ui/wm/public/easy_resize_window_targeter.h
blob: c4c7137abd3808680334f256bb724f21442340b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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_