| OLD | NEW |
| 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/controls/button/custom_button.h" | 9 #include "ui/views/animation/button_ink_drop_delegate.h" |
| 10 | 10 #include "ui/views/controls/button/label_button.h" |
| 11 namespace gfx { | |
| 12 class RenderText; | |
| 13 } | |
| 14 | 11 |
| 15 namespace views { | 12 namespace views { |
| 16 | 13 |
| 17 // A button class that implements the Material Design text button spec. | 14 // A button class that implements the Material Design text button spec. |
| 18 class VIEWS_EXPORT MdTextButton : public CustomButton { | 15 class VIEWS_EXPORT MdTextButton : public LabelButton { |
| 19 public: | 16 public: |
| 20 MdTextButton(ButtonListener* listener, const base::string16& text); | 17 // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton |
| 18 // in MD mode. |
| 19 static LabelButton* CreateStandardButton(ButtonListener* listener, |
| 20 const base::string16& text); |
| 21 |
| 22 // LabelButton: |
| 23 SkColor GetInkDropBaseColor() const override; |
| 24 void SetText(const base::string16& text) override; |
| 25 |
| 26 private: |
| 27 MdTextButton(ButtonListener* listener); |
| 21 ~MdTextButton() override; | 28 ~MdTextButton() override; |
| 22 | 29 |
| 23 // View: | 30 ButtonInkDropDelegate ink_drop_delegate_; |
| 24 void OnPaint(gfx::Canvas* canvas) override; | |
| 25 gfx::Size GetPreferredSize() const override; | |
| 26 | |
| 27 private: | |
| 28 void UpdateColor(); | |
| 29 | |
| 30 scoped_ptr<gfx::RenderText> render_text_; | |
| 31 | 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(MdTextButton); | 32 DISALLOW_COPY_AND_ASSIGN(MdTextButton); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace views | 35 } // namespace views |
| 36 | 36 |
| 37 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ | 37 #endif // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_ |
| OLD | NEW |