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

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

Issue 1800973002: MD text buttons - implement focus ring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MD_TEXT_BUTTON_H_ 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 6 #define UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/views/animation/button_ink_drop_delegate.h" 9 #include "ui/views/animation/button_ink_drop_delegate.h"
10 #include "ui/views/controls/button/label_button.h" 10 #include "ui/views/controls/button/label_button.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 // A button class that implements the Material Design text button spec. 14 // A button class that implements the Material Design text button spec.
15 class VIEWS_EXPORT MdTextButton : public LabelButton { 15 class VIEWS_EXPORT MdTextButton : public LabelButton {
16 public: 16 public:
17 // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton 17 // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton
18 // in MD mode. 18 // in MD mode.
19 static LabelButton* CreateStandardButton(ButtonListener* listener, 19 static LabelButton* CreateStandardButton(ButtonListener* listener,
20 const base::string16& text); 20 const base::string16& text);
21 21
22 // LabelButton: 22 // LabelButton:
23 void Layout() override;
23 SkColor GetInkDropBaseColor() const override; 24 SkColor GetInkDropBaseColor() const override;
24 void SetText(const base::string16& text) override; 25 void SetText(const base::string16& text) override;
25 26
27 protected:
28 // LabelButton:
29 void OnFocus() override;
30 void OnBlur() override;
31
26 private: 32 private:
27 MdTextButton(ButtonListener* listener); 33 MdTextButton(ButtonListener* listener);
28 ~MdTextButton() override; 34 ~MdTextButton() override;
29 35
30 ButtonInkDropDelegate ink_drop_delegate_; 36 ButtonInkDropDelegate ink_drop_delegate_;
31 37
38 // A child view to draw the focus ring. This is not done via a FocusPainter
39 // because it needs to paint to a layer so it can extend beyond the bounds of
40 // |this|.
41 views::View* focus_ring_;
42
32 DISALLOW_COPY_AND_ASSIGN(MdTextButton); 43 DISALLOW_COPY_AND_ASSIGN(MdTextButton);
33 }; 44 };
34 45
35 } // namespace views 46 } // namespace views
36 47
37 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ 48 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698