Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: ui/views/animation/ink_drop_painted_layer_delegates.h

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4 #ifndef UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
5 #define UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
6
7 #include "base/callback.h"
8 #include "base/macros.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/compositor/layer_delegate.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h"
13
14 namespace views {
15
16 // Base ui::LayerDelegate stub that can be extended to paint shapes of a
17 // specific color.
18 class BasePaintedLayerDelegate : public ui::LayerDelegate {
19 public:
20 ~BasePaintedLayerDelegate() override;
21
22 SkColor color() const { return color_; }
23
24 // ui::LayerDelegate:
25 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override;
26 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
27 base::Closure PrepareForLayerBoundsChange() override;
28
29 protected:
30 explicit BasePaintedLayerDelegate(SkColor color);
31
32 private:
33 // The color to paint.
34 SkColor color_;
35
36 DISALLOW_COPY_AND_ASSIGN(BasePaintedLayerDelegate);
37 };
38
39 // A BasePaintedLayerDelegate that paints a circle of a specified color and
40 // radius.
41 class CircleLayerDelegate : public BasePaintedLayerDelegate {
42 public:
43 CircleLayerDelegate(SkColor color, int radius);
44 ~CircleLayerDelegate() override;
45
46 int radius() const { return radius_; }
47
48 // ui::LayerDelegate:
49 void OnPaintLayer(const ui::PaintContext& context) override;
50
51 private:
52 // The radius of the circle.
53 int radius_;
54
55 DISALLOW_COPY_AND_ASSIGN(CircleLayerDelegate);
56 };
57
58 // A BasePaintedLayerDelegate that paints a rectangle of a specified color and
59 // size.
60 class RectangleLayerDelegate : public BasePaintedLayerDelegate {
61 public:
62 RectangleLayerDelegate(SkColor color, gfx::Size size);
63 ~RectangleLayerDelegate() override;
64
65 const gfx::Size& size() const { return size_; }
66
67 // ui::LayerDelegate:
68 void OnPaintLayer(const ui::PaintContext& context) override;
69
70 private:
71 // The size of the rectangle.
72 gfx::Size size_;
73
74 DISALLOW_COPY_AND_ASSIGN(RectangleLayerDelegate);
75 };
76
77 // A BasePaintedLayerDelegate that paints a rounded rectangle of a specified
78 // color, size and corner radius.
79 class RoundedRectangleLayerDelegate : public BasePaintedLayerDelegate {
80 public:
81 RoundedRectangleLayerDelegate(SkColor color,
82 gfx::Size size,
83 int corner_radius);
84 ~RoundedRectangleLayerDelegate() override;
85
86 const gfx::Size& size() const { return size_; }
87
88 // ui::LayerDelegate:
89 void OnPaintLayer(const ui::PaintContext& context) override;
90
91 private:
92 // The size of the rectangle.
93 gfx::Size size_;
94
95 // The radius of the corners.
96 int corner_radius_;
97
98 DISALLOW_COPY_AND_ASSIGN(RoundedRectangleLayerDelegate);
99 };
100
101 } // namespace views
102
103 #endif // UI_VIEWS_ANIMATION_INK_DROP_PAINTED_LAYER_DELEGATES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698