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

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

Issue 1390113006: Added material design mouse hover feedback support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed pkasting@'s comments from patch set 13. Created 5 years, 1 month 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/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/events/event_constants.h" 9 #include "ui/events/event_constants.h"
10 #include "ui/gfx/animation/animation_delegate.h" 10 #include "ui/gfx/animation/animation_delegate.h"
11 #include "ui/views/animation/ink_drop_consumer.h"
11 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 class ThrobAnimation; 15 class ThrobAnimation;
15 } 16 }
16 17
17 namespace views { 18 namespace views {
18 19
19 // A button with custom rendering. The base of ImageButton and LabelButton. 20 // A button with custom rendering. The base of ImageButton and LabelButton.
20 // Note that this type of button is not focusable by default and will not be 21 // Note that this type of button is not focusable by default and will not be
21 // part of the focus chain. Call SetFocusable(true) to make it part of the 22 // part of the focus chain. Call SetFocusable(true) to make it part of the
22 // focus chain. 23 // focus chain.
23 class VIEWS_EXPORT CustomButton : public Button, 24 class VIEWS_EXPORT CustomButton : public Button,
24 public gfx::AnimationDelegate { 25 public gfx::AnimationDelegate,
26 public views::InkDropConsumer {
25 public: 27 public:
26 // An enum describing the events on which a button should notify its listener. 28 // An enum describing the events on which a button should notify its listener.
27 enum NotifyAction { 29 enum NotifyAction {
28 NOTIFY_ON_PRESS, 30 NOTIFY_ON_PRESS,
29 NOTIFY_ON_RELEASE, 31 NOTIFY_ON_RELEASE,
30 }; 32 };
31 33
32 // The menu button's class name. 34 // The menu button's class name.
33 static const char kViewClassName[]; 35 static const char kViewClassName[];
34 36
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 93 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
92 void ShowContextMenu(const gfx::Point& p, 94 void ShowContextMenu(const gfx::Point& p,
93 ui::MenuSourceType source_type) override; 95 ui::MenuSourceType source_type) override;
94 void OnDragDone() override; 96 void OnDragDone() override;
95 void GetAccessibleState(ui::AXViewState* state) override; 97 void GetAccessibleState(ui::AXViewState* state) override;
96 void VisibilityChanged(View* starting_from, bool is_visible) override; 98 void VisibilityChanged(View* starting_from, bool is_visible) override;
97 99
98 // Overridden from gfx::AnimationDelegate: 100 // Overridden from gfx::AnimationDelegate:
99 void AnimationProgressed(const gfx::Animation* animation) override; 101 void AnimationProgressed(const gfx::Animation* animation) override;
100 102
103 // Overriden from views::InkDropConsumer:
104 bool ShouldShowInkDropHover() override;
105
101 protected: 106 protected:
102 // 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.
103 explicit CustomButton(ButtonListener* listener); 108 explicit CustomButton(ButtonListener* listener);
104 109
105 // 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
106 // the current state. CustomButton's implementation of StateChanged() does 111 // the current state. CustomButton's implementation of StateChanged() does
107 // nothing; this method is provided for subclasses that wish to do something 112 // nothing; this method is provided for subclasses that wish to do something
108 // on state changes. 113 // on state changes.
109 virtual void StateChanged(); 114 virtual void StateChanged();
110 115
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 154
150 // The event on which the button should notify its listener. 155 // The event on which the button should notify its listener.
151 NotifyAction notify_action_; 156 NotifyAction notify_action_;
152 157
153 DISALLOW_COPY_AND_ASSIGN(CustomButton); 158 DISALLOW_COPY_AND_ASSIGN(CustomButton);
154 }; 159 };
155 160
156 } // namespace views 161 } // namespace views
157 162
158 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 163 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698