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

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

Issue 1569113002: MacViews: Style BUTTON_STYLE buttons using the "modern" UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: respond to comments, desktop linux Created 4 years, 8 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/gfx/animation/throb_animation.h" 12 #include "ui/gfx/animation/throb_animation.h"
13 #include "ui/views/animation/ink_drop_state.h" 13 #include "ui/views/animation/ink_drop_state.h"
14 #include "ui/views/controls/button/button.h" 14 #include "ui/views/controls/button/button.h"
15 15
16 namespace views { 16 namespace views {
17 17
18 class InkDropDelegate; 18 class InkDropDelegate;
19 class LabelButton;
19 20
20 // A button with custom rendering. The base of ImageButton and LabelButton. 21 // A button with custom rendering. The base of ImageButton and LabelButton.
21 // Note that this type of button is not focusable by default and will not be 22 // Note that this type of button is not focusable by default and will not be
22 // part of the focus chain. Call SetFocusable(true) to make it part of the 23 // part of the focus chain. Call SetFocusable(true) to make it part of the
23 // focus chain. 24 // focus chain.
24 class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate { 25 class VIEWS_EXPORT CustomButton : public Button, public gfx::AnimationDelegate {
25 public: 26 public:
26 // An enum describing the events on which a button should notify its listener. 27 // An enum describing the events on which a button should notify its listener.
27 enum NotifyAction { 28 enum NotifyAction {
28 NOTIFY_ON_PRESS, 29 NOTIFY_ON_PRESS,
29 NOTIFY_ON_RELEASE, 30 NOTIFY_ON_RELEASE,
30 }; 31 };
31 32
32 // The menu button's class name. 33 // The menu button's class name.
33 static const char kViewClassName[]; 34 static const char kViewClassName[];
34 35
35 static const CustomButton* AsCustomButton(const views::View* view); 36 static const CustomButton* AsCustomButton(const views::View* view);
36 static CustomButton* AsCustomButton(views::View* view); 37 static CustomButton* AsCustomButton(views::View* view);
38 static const LabelButton* AsLabelButton(const views::View* view);
sky 2016/04/07 17:16:31 I am not a fan of using the view class name for RT
tapted 2016/04/08 08:35:33 There's not really any logic that depends on the R
39 static LabelButton* AsLabelButton(views::View* view);
37 40
38 ~CustomButton() override; 41 ~CustomButton() override;
39 42
40 // Get/sets the current display state of the button. 43 // Get/sets the current display state of the button.
41 ButtonState state() const { return state_; } 44 ButtonState state() const { return state_; }
42 void SetState(ButtonState state); 45 void SetState(ButtonState state);
43 46
44 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop. 47 // Starts throbbing. See HoverAnimation for a description of cycles_til_stop.
45 void StartThrobbing(int cycles_til_stop); 48 void StartThrobbing(int cycles_til_stop);
46 49
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // because it needs to paint to a layer so it can extend beyond the bounds of 203 // because it needs to paint to a layer so it can extend beyond the bounds of
201 // |this|. 204 // |this|.
202 views::View* md_focus_ring_; 205 views::View* md_focus_ring_;
203 206
204 DISALLOW_COPY_AND_ASSIGN(CustomButton); 207 DISALLOW_COPY_AND_ASSIGN(CustomButton);
205 }; 208 };
206 209
207 } // namespace views 210 } // namespace views
208 211
209 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_ 212 #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698