summaryrefslogtreecommitdiffstats
path: root/ash/wm/resize_shadow.h
blob: 6add50f775562108164be449a362b8f3b6a06477 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2012 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 ASH_WM_RESIZE_SHADOW_H_
#define ASH_WM_RESIZE_SHADOW_H_

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"

namespace aura {
class Window;
}
namespace gfx {
class Rect;
}
namespace ui {
class Layer;
}
namespace wm {
class ImageGrid;
}

namespace ash {

// A class to render the resize edge effect when the user moves their mouse
// over a sizing edge.  This is just a visual effect; the actual resize is
// handled by the EventFilter.
class ResizeShadow {
 public:
  ResizeShadow();
  ~ResizeShadow();

  // Initializes the resize effect layers for a given |window|.
  void Init(aura::Window* window);

  // Shows resize effects for one or more edges based on a |hit_test| code, such
  // as HTRIGHT or HTBOTTOMRIGHT.
  void ShowForHitTest(int hit_test);

  // Hides all resize effects.
  void Hide();

  // Updates the effect positions based on the |bounds| of the window.
  void Layout(const gfx::Rect& bounds);

  int GetLastHitTestForTest() const {
    return last_hit_test_;
  }

 private:
  // Images for the shadow effect.
  scoped_ptr< ::wm::ImageGrid> image_grid_;

  // Hit test value from last call to ShowForHitTest().  Used to prevent
  // repeatedly triggering the same animations for the same hit.
  int last_hit_test_;

  DISALLOW_COPY_AND_ASSIGN(ResizeShadow);
};

}  // namespace ash

#endif  // ASH_WM_RESIZE_SHADOW_H_