summaryrefslogtreecommitdiffstats
path: root/ui/views/controls/button/md_text_button.h
blob: 8350dac7c68a4c172941f51810c8ef32709d64a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_
#define UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_

#include "base/memory/scoped_ptr.h"
#include "ui/views/animation/button_ink_drop_delegate.h"
#include "ui/views/controls/button/label_button.h"

namespace views {

// A button class that implements the Material Design text button spec.
class VIEWS_EXPORT MdTextButton : public LabelButton {
 public:
  // Describes the presentation of a button. A stronger call to action draws
  // more attention.
  enum CallToAction {
    NO_CALL_TO_ACTION,  // Default.
    WEAK_CALL_TO_ACTION,
    STRONG_CALL_TO_ACTION,
  };

  // Creates a normal STYLE_BUTTON LabelButton in pre-MD, or an MdTextButton
  // in MD mode.
  static LabelButton* CreateStandardButton(ButtonListener* listener,
                                           const base::string16& text);
  static MdTextButton* CreateMdButton(ButtonListener* listener,
                                      const base::string16& text);

  void SetCallToAction(CallToAction cta);

  // LabelButton:
  void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
  SkColor GetInkDropBaseColor() const override;
  void SetText(const base::string16& text) override;

 private:
  MdTextButton(ButtonListener* listener);
  ~MdTextButton() override;

  void UpdateColorsFromNativeTheme();

  ButtonInkDropDelegate ink_drop_delegate_;

  // The call to action style for this button.
  CallToAction cta_;

  DISALLOW_COPY_AND_ASSIGN(MdTextButton);
};

}  // namespace views

#endif  // UI_VIEWS_CONTROLS_BUTTON_MD_TEXT_BUTTON_H_