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

Side by Side Diff: ui/views/controls/button/custom_button.h

Issue 1682893002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unit tests Created 4 years, 10 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // See description above field. 68 // See description above field.
69 void set_animate_on_state_change(bool value) { 69 void set_animate_on_state_change(bool value) {
70 animate_on_state_change_ = value; 70 animate_on_state_change_ = value;
71 } 71 }
72 72
73 // Sets the event on which the button should notify its listener. 73 // Sets the event on which the button should notify its listener.
74 void set_notify_action(NotifyAction notify_action) { 74 void set_notify_action(NotifyAction notify_action) {
75 notify_action_ = notify_action; 75 notify_action_ = notify_action;
76 } 76 }
77 77
78 void set_ink_drop_base_color(SkColor color) { ink_drop_base_color_ = color; }
79
78 void SetHotTracked(bool is_hot_tracked); 80 void SetHotTracked(bool is_hot_tracked);
79 bool IsHotTracked() const; 81 bool IsHotTracked() const;
80 82
81 // Overridden from View: 83 // Overridden from View:
82 void Layout() override; 84 void Layout() override;
83 void OnEnabledChanged() override; 85 void OnEnabledChanged() override;
84 const char* GetClassName() const override; 86 const char* GetClassName() const override;
85 bool OnMousePressed(const ui::MouseEvent& event) override; 87 bool OnMousePressed(const ui::MouseEvent& event) override;
86 bool OnMouseDragged(const ui::MouseEvent& event) override; 88 bool OnMouseDragged(const ui::MouseEvent& event) override;
87 void OnMouseReleased(const ui::MouseEvent& event) override; 89 void OnMouseReleased(const ui::MouseEvent& event) override;
(...skipping 13 matching lines...) Expand all
101 void VisibilityChanged(View* starting_from, bool is_visible) override; 103 void VisibilityChanged(View* starting_from, bool is_visible) override;
102 104
103 // Overridden from gfx::AnimationDelegate: 105 // Overridden from gfx::AnimationDelegate:
104 void AnimationProgressed(const gfx::Animation* animation) override; 106 void AnimationProgressed(const gfx::Animation* animation) override;
105 107
106 // Overridden from views::InkDropHost: 108 // Overridden from views::InkDropHost:
107 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; 109 void AddInkDropLayer(ui::Layer* ink_drop_layer) override;
108 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; 110 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override;
109 gfx::Point CalculateInkDropCenter() const override; 111 gfx::Point CalculateInkDropCenter() const override;
110 bool ShouldShowInkDropHover() const override; 112 bool ShouldShowInkDropHover() const override;
113 SkColor GetInkDropBaseColor() const override;
111 114
112 protected: 115 protected:
113 // Construct the Button with a Listener. See comment for Button's ctor. 116 // Construct the Button with a Listener. See comment for Button's ctor.
114 explicit CustomButton(ButtonListener* listener); 117 explicit CustomButton(ButtonListener* listener);
115 118
116 // Invoked from SetState() when SetState() is passed a value that differs from 119 // Invoked from SetState() when SetState() is passed a value that differs from
117 // the current state. CustomButton's implementation of StateChanged() does 120 // the current state. CustomButton's implementation of StateChanged() does
118 // nothing; this method is provided for subclasses that wish to do something 121 // nothing; this method is provided for subclasses that wish to do something
119 // on state changes. 122 // on state changes.
120 virtual void StateChanged(); 123 virtual void StateChanged();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 195
193 // True when a button click should trigger an animation action on 196 // True when a button click should trigger an animation action on
194 // |ink_drop_delegate_|. 197 // |ink_drop_delegate_|.
195 // TODO(bruthig): Use an InkDropAction enum and drop the flag. 198 // TODO(bruthig): Use an InkDropAction enum and drop the flag.
196 bool has_ink_drop_action_on_click_; 199 bool has_ink_drop_action_on_click_;
197 200
198 // The animation action to trigger on the |ink_drop_delegate_| when the button 201 // The animation action to trigger on the |ink_drop_delegate_| when the button
199 // is clicked. 202 // is clicked.
200 InkDropState ink_drop_action_on_click_; 203 InkDropState ink_drop_action_on_click_;
201 204
205 // The color of the ripple and hover.
206 SkColor ink_drop_base_color_;
207
202 DISALLOW_COPY_AND_ASSIGN(CustomButton); 208 DISALLOW_COPY_AND_ASSIGN(CustomButton);
203 }; 209 };
204 210
205 } // namespace views 211 } // namespace views
206 212
207 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 213 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698