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

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

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: check details Created 3 years, 9 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
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/bubble/bubble_frame_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ 5 #ifndef UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_
6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ 6 #define UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // 51 //
52 // TODO(bruthig): Add an easier mechanism than overriding functions to allow 52 // TODO(bruthig): Add an easier mechanism than overriding functions to allow
53 // subclasses/clients to specify the flavor of ink drop. 53 // subclasses/clients to specify the flavor of ink drop.
54 void SetInkDropMode(InkDropMode ink_drop_mode); 54 void SetInkDropMode(InkDropMode ink_drop_mode);
55 55
56 void set_ink_drop_visible_opacity(float visible_opacity) { 56 void set_ink_drop_visible_opacity(float visible_opacity) {
57 ink_drop_visible_opacity_ = visible_opacity; 57 ink_drop_visible_opacity_ = visible_opacity;
58 } 58 }
59 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; } 59 float ink_drop_visible_opacity() const { return ink_drop_visible_opacity_; }
60 60
61 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the
62 // last_ripple_triggering_event().
63 //
64 // *** NOTE ***: |event| has been plumbed through on a best effort basis for
65 // the purposes of centering ink drop ripples on located Events. Thus nullptr
66 // has been used by clients who do not have an Event instance available to
67 // them.
68 void AnimateInkDrop(InkDropState state, const ui::LocatedEvent* event);
69
61 protected: 70 protected:
62 static constexpr int kInkDropSmallCornerRadius = 2; 71 static constexpr int kInkDropSmallCornerRadius = 2;
63 static constexpr int kInkDropLargeCornerRadius = 4; 72 static constexpr int kInkDropLargeCornerRadius = 4;
64 73
65 // Size used for the default SquareInkDropRipple. 74 // Size used for the default SquareInkDropRipple.
66 static constexpr int kDefaultInkDropSize = 24; 75 static constexpr int kDefaultInkDropSize = 24;
67 76
68 // Returns a large ink drop size based on the |small_size| that works well 77 // Returns a large ink drop size based on the |small_size| that works well
69 // with the SquareInkDropRipple animation durations. 78 // with the SquareInkDropRipple animation durations.
70 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size); 79 static gfx::Size CalculateLargeInkDropSize(const gfx::Size& small_size);
71 80
72 // Returns the default InkDropRipple centered on |center_point|. 81 // Returns the default InkDropRipple centered on |center_point|.
73 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple( 82 std::unique_ptr<InkDropRipple> CreateDefaultInkDropRipple(
74 const gfx::Point& center_point, 83 const gfx::Point& center_point,
75 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, 84 const gfx::Size& size = gfx::Size(kDefaultInkDropSize,
76 kDefaultInkDropSize)) const; 85 kDefaultInkDropSize)) const;
77 86
78 // Returns the default InkDropHighlight centered on |center_point|. 87 // Returns the default InkDropHighlight centered on |center_point|.
79 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight( 88 std::unique_ptr<InkDropHighlight> CreateDefaultInkDropHighlight(
80 const gfx::PointF& center_point, 89 const gfx::PointF& center_point,
81 const gfx::Size& size = gfx::Size(kDefaultInkDropSize, 90 const gfx::Size& size = gfx::Size(kDefaultInkDropSize,
82 kDefaultInkDropSize)) const; 91 kDefaultInkDropSize)) const;
83 92
84 // Returns the point of the |last_ripple_triggering_event_| if it was a 93 // Returns the point of the |last_ripple_triggering_event_| if it was a
85 // LocatedEvent, otherwise the center point of the local bounds is returned. 94 // LocatedEvent, otherwise the center point of the local bounds is returned.
86 gfx::Point GetInkDropCenterBasedOnLastEvent() const; 95 gfx::Point GetInkDropCenterBasedOnLastEvent() const;
87 96
88 // Animates |ink_drop_| to the desired |ink_drop_state|. Caches |event| as the
89 // last_ripple_triggering_event().
90 //
91 // *** NOTE ***: |event| has been plumbed through on a best effort basis for
92 // the purposes of centering ink drop ripples on located Events. Thus nullptr
93 // has been used by clients who do not have an Event instance available to
94 // them.
95 void AnimateInkDrop(InkDropState state, const ui::LocatedEvent* event);
96
97 // View: 97 // View:
98 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 98 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
99 void VisibilityChanged(View* starting_from, bool is_visible) override; 99 void VisibilityChanged(View* starting_from, bool is_visible) override;
100 void OnFocus() override; 100 void OnFocus() override;
101 void OnBlur() override; 101 void OnBlur() override;
102 void OnMouseEvent(ui::MouseEvent* event) override; 102 void OnMouseEvent(ui::MouseEvent* event) override;
103 103
104 // Overrideable methods to allow views to provide minor tweaks to the default 104 // Overrideable methods to allow views to provide minor tweaks to the default
105 // ink drop. 105 // ink drop.
106 virtual SkColor GetInkDropBaseColor() const; 106 virtual SkColor GetInkDropBaseColor() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 bool destroying_; 149 bool destroying_;
150 150
151 std::unique_ptr<views::InkDropMask> ink_drop_mask_; 151 std::unique_ptr<views::InkDropMask> ink_drop_mask_;
152 152
153 DISALLOW_COPY_AND_ASSIGN(InkDropHostView); 153 DISALLOW_COPY_AND_ASSIGN(InkDropHostView);
154 }; 154 };
155 } // namespace views 155 } // namespace views
156 156
157 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_ 157 #endif // UI_VIEWS_ANIMATION_INK_DROP_HOST_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/bubble/bubble_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698