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

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

Issue 1724963002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review Created 4 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // See description above field. 65 // See description above field.
66 void set_animate_on_state_change(bool value) { 66 void set_animate_on_state_change(bool value) {
67 animate_on_state_change_ = value; 67 animate_on_state_change_ = value;
68 } 68 }
69 69
70 // Sets the event on which the button should notify its listener. 70 // Sets the event on which the button should notify its listener.
71 void set_notify_action(NotifyAction notify_action) { 71 void set_notify_action(NotifyAction notify_action) {
72 notify_action_ = notify_action; 72 notify_action_ = notify_action;
73 } 73 }
74 74
75 void set_ink_drop_base_color(SkColor color) { ink_drop_base_color_ = color; }
76
75 void SetHotTracked(bool is_hot_tracked); 77 void SetHotTracked(bool is_hot_tracked);
76 bool IsHotTracked() const; 78 bool IsHotTracked() const;
77 79
78 // Overridden from View: 80 // Overridden from View:
79 void OnEnabledChanged() override; 81 void OnEnabledChanged() override;
80 const char* GetClassName() const override; 82 const char* GetClassName() const override;
81 bool OnMousePressed(const ui::MouseEvent& event) override; 83 bool OnMousePressed(const ui::MouseEvent& event) override;
82 bool OnMouseDragged(const ui::MouseEvent& event) override; 84 bool OnMouseDragged(const ui::MouseEvent& event) override;
83 void OnMouseReleased(const ui::MouseEvent& event) override; 85 void OnMouseReleased(const ui::MouseEvent& event) override;
84 void OnMouseCaptureLost() override; 86 void OnMouseCaptureLost() override;
85 void OnMouseEntered(const ui::MouseEvent& event) override; 87 void OnMouseEntered(const ui::MouseEvent& event) override;
86 void OnMouseExited(const ui::MouseEvent& event) override; 88 void OnMouseExited(const ui::MouseEvent& event) override;
87 void OnMouseMoved(const ui::MouseEvent& event) override; 89 void OnMouseMoved(const ui::MouseEvent& event) override;
88 bool OnKeyPressed(const ui::KeyEvent& event) override; 90 bool OnKeyPressed(const ui::KeyEvent& event) override;
89 bool OnKeyReleased(const ui::KeyEvent& event) override; 91 bool OnKeyReleased(const ui::KeyEvent& event) override;
90 void OnGestureEvent(ui::GestureEvent* event) override; 92 void OnGestureEvent(ui::GestureEvent* event) override;
91 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 93 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
92 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override; 94 bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) override;
93 void ShowContextMenu(const gfx::Point& p, 95 void ShowContextMenu(const gfx::Point& p,
94 ui::MenuSourceType source_type) override; 96 ui::MenuSourceType source_type) override;
95 void OnDragDone() override; 97 void OnDragDone() override;
96 void GetAccessibleState(ui::AXViewState* state) override; 98 void GetAccessibleState(ui::AXViewState* state) override;
97 void VisibilityChanged(View* starting_from, bool is_visible) override; 99 void VisibilityChanged(View* starting_from, bool is_visible) override;
98 scoped_ptr<InkDropHover> CreateInkDropHover() const override; 100 scoped_ptr<InkDropHover> CreateInkDropHover() const override;
101 SkColor GetInkDropBaseColor() const override;
99 102
100 // Overridden from gfx::AnimationDelegate: 103 // Overridden from gfx::AnimationDelegate:
101 void AnimationProgressed(const gfx::Animation* animation) override; 104 void AnimationProgressed(const gfx::Animation* animation) override;
102 105
103 protected: 106 protected:
104 // Construct the Button with a Listener. See comment for Button's ctor. 107 // Construct the Button with a Listener. See comment for Button's ctor.
105 explicit CustomButton(ButtonListener* listener); 108 explicit CustomButton(ButtonListener* listener);
106 109
107 // Invoked from SetState() when SetState() is passed a value that differs from 110 // Invoked from SetState() when SetState() is passed a value that differs from
108 // the current state. CustomButton's implementation of StateChanged() does 111 // the current state. CustomButton's implementation of StateChanged() does
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 179
177 // True when a button click should trigger an animation action on 180 // True when a button click should trigger an animation action on
178 // |ink_drop_delegate_|. 181 // |ink_drop_delegate_|.
179 // TODO(bruthig): Use an InkDropAction enum and drop the flag. 182 // TODO(bruthig): Use an InkDropAction enum and drop the flag.
180 bool has_ink_drop_action_on_click_; 183 bool has_ink_drop_action_on_click_;
181 184
182 // The animation action to trigger on the |ink_drop_delegate_| when the button 185 // The animation action to trigger on the |ink_drop_delegate_| when the button
183 // is clicked. 186 // is clicked.
184 InkDropState ink_drop_action_on_click_; 187 InkDropState ink_drop_action_on_click_;
185 188
189 // The color of the ripple and hover.
190 SkColor ink_drop_base_color_;
191
186 DISALLOW_COPY_AND_ASSIGN(CustomButton); 192 DISALLOW_COPY_AND_ASSIGN(CustomButton);
187 }; 193 };
188 194
189 } // namespace views 195 } // namespace views
190 196
191 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 197 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW
« no previous file with comments | « ui/views/animation/test/test_ink_drop_host.cc ('k') | ui/views/controls/button/custom_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698