Index: ui/views/controls/button/label_button_label.h |
diff --git a/ui/views/controls/button/label_button_label.h b/ui/views/controls/button/label_button_label.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b8bee83847b7ac576159206a3d5530c3ac971b52 |
--- /dev/null |
+++ b/ui/views/controls/button/label_button_label.h |
@@ -0,0 +1,42 @@ |
+// Copyright 2017 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_LABEL_BUTTON_LABEL_H_ |
+#define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_LABEL_H_ |
+ |
+#include "base/macros.h" |
+#include "base/strings/string16.h" |
+#include "third_party/skia/include/core/SkColor.h" |
+#include "ui/views/controls/label.h" |
+ |
+namespace views { |
+ |
+// A Label subclass that can be disabled, for use in a LabelButton. |
+class LabelButtonLabel : public Label { |
sky
2017/06/06 17:12:24
Please document this is an implementation detail,
tapted
2017/06/08 04:11:31
Done. Although the second bit was tricky - see lat
|
+ public: |
+ LabelButtonLabel(const base::string16& text, int text_context); |
+ ~LabelButtonLabel() override; |
+ |
+ void SetDisabledColor(SkColor color); |
+ |
+ protected: |
+ // Label: |
+ void OnEnabledChanged() override; |
+ void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
+ SkColor GetForegroundColor() const override; |
+ void OnBackgroundColorChanged() override; |
+ |
+ private: |
+ void SetDisabledColorInternal(SkColor color, bool from_theme); |
+ |
+ SkColor requested_disabled_color_ = SK_ColorRED; |
+ SkColor actual_disabled_color_ = SK_ColorRED; |
+ bool disabled_color_set_ = false; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(LabelButtonLabel); |
+}; |
+ |
+} // namespace views |
+ |
+#endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_LABEL_H_ |