summaryrefslogtreecommitdiffstats
path: root/views/controls/button
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls/button')
-rw-r--r--views/controls/button/text_button.cc8
-rw-r--r--views/controls/button/text_button.h8
2 files changed, 16 insertions, 0 deletions
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 5c1ec29..2125a02 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -34,6 +34,9 @@ const SkColor TextButton::kHoverColor = TextButton::kEnabledColor;
// How long the hover fade animation should last.
static const int kHoverAnimationDurationMs = 170;
+// static
+const char TextButton::kViewClassName[] = "views/TextButton";
+
static int PrefixTypeToCanvasType(TextButton::PrefixType type) {
switch (type) {
case TextButton::PREFIX_HIDE:
@@ -203,6 +206,7 @@ TextButton::~TextButton() {
void TextButton::SetText(const std::wstring& text) {
text_ = text;
+ SetAccessibleName(text);
UpdateTextSize();
}
@@ -427,6 +431,10 @@ void TextButton::SetEnabled(bool enabled) {
SchedulePaint();
}
+std::string TextButton::GetClassName() const {
+ return kViewClassName;
+}
+
void TextButton::Paint(gfx::Canvas* canvas) {
Paint(canvas, false);
}
diff --git a/views/controls/button/text_button.h b/views/controls/button/text_button.h
index 310bbda..d37f1aa 100644
--- a/views/controls/button/text_button.h
+++ b/views/controls/button/text_button.h
@@ -6,6 +6,8 @@
#define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_
#pragma once
+#include <string>
+
#include "gfx/font.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -72,6 +74,9 @@ class TextButtonBorder : public Border {
////////////////////////////////////////////////////////////////////////////////
class TextButton : public CustomButton {
public:
+ // The menu button's class name.
+ static const char kViewClassName[];
+
// Enumeration of how the prefix ('&') character is processed. The default
// is |PREFIX_NONE|.
enum PrefixType {
@@ -153,6 +158,9 @@ class TextButton : public CustomButton {
static const SkColor kDisabledColor;
static const SkColor kHoverColor;
+ // Returns views/TextButton.
+ virtual std::string GetClassName() const;
+
protected:
SkBitmap icon() const { return icon_; }