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

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

Issue 1550443002: Pushed InkDropHost inheritence up to CustomButton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed doc typo. Created 4 years, 11 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"
11 #include "ui/gfx/animation/animation_delegate.h" 11 #include "ui/gfx/animation/animation_delegate.h"
12 #include "ui/views/animation/ink_drop_host.h"
12 #include "ui/views/animation/ink_drop_state.h" 13 #include "ui/views/animation/ink_drop_state.h"
13 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 class ThrobAnimation; 17 class ThrobAnimation;
17 } 18 }
18 19
19 namespace views { 20 namespace views {
20 21
21 class InkDropDelegate; 22 class InkDropDelegate;
22 23
23 // A button with custom rendering. The base of ImageButton and LabelButton. 24 // A button with custom rendering. The base of ImageButton and LabelButton.
24 // Note that this type of button is not focusable by default and will not be 25 // Note that this type of button is not focusable by default and will not be
25 // part of the focus chain. Call SetFocusable(true) to make it part of the 26 // part of the focus chain. Call SetFocusable(true) to make it part of the
26 // focus chain. 27 // focus chain.
27 class VIEWS_EXPORT CustomButton : public Button, 28 class VIEWS_EXPORT CustomButton : public Button,
28 public gfx::AnimationDelegate { 29 public gfx::AnimationDelegate,
30 public views::InkDropHost {
29 public: 31 public:
30 // An enum describing the events on which a button should notify its listener. 32 // An enum describing the events on which a button should notify its listener.
31 enum NotifyAction { 33 enum NotifyAction {
32 NOTIFY_ON_PRESS, 34 NOTIFY_ON_PRESS,
33 NOTIFY_ON_RELEASE, 35 NOTIFY_ON_RELEASE,
34 }; 36 };
35 37
36 // The menu button's class name. 38 // The menu button's class name.
37 static const char kViewClassName[]; 39 static const char kViewClassName[];
38 40
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; 98 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
97 void ShowContextMenu(const gfx::Point& p, 99 void ShowContextMenu(const gfx::Point& p,
98 ui::MenuSourceType source_type) override; 100 ui::MenuSourceType source_type) override;
99 void OnDragDone() override; 101 void OnDragDone() override;
100 void GetAccessibleState(ui::AXViewState* state) override; 102 void GetAccessibleState(ui::AXViewState* state) override;
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
108 // Overridden from views::InkDropHost:
109 gfx::Point CalculateInkDropCenter() const override;
110
106 protected: 111 protected:
107 // Construct the Button with a Listener. See comment for Button's ctor. 112 // Construct the Button with a Listener. See comment for Button's ctor.
108 explicit CustomButton(ButtonListener* listener); 113 explicit CustomButton(ButtonListener* listener);
109 114
110 // Invoked from SetState() when SetState() is passed a value that differs from 115 // Invoked from SetState() when SetState() is passed a value that differs from
111 // the current state. CustomButton's implementation of StateChanged() does 116 // the current state. CustomButton's implementation of StateChanged() does
112 // nothing; this method is provided for subclasses that wish to do something 117 // nothing; this method is provided for subclasses that wish to do something
113 // on state changes. 118 // on state changes.
114 virtual void StateChanged(); 119 virtual void StateChanged();
115 120
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // The animation action to trigger on the |ink_drop_delegate_| when the button 192 // The animation action to trigger on the |ink_drop_delegate_| when the button
188 // is clicked. 193 // is clicked.
189 InkDropState ink_drop_action_on_click_; 194 InkDropState ink_drop_action_on_click_;
190 195
191 DISALLOW_COPY_AND_ASSIGN(CustomButton); 196 DISALLOW_COPY_AND_ASSIGN(CustomButton);
192 }; 197 };
193 198
194 } // namespace views 199 } // namespace views
195 200
196 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 201 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698