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

Unified Diff: ui/views/controls/button/label_button_label.h

Issue 2913933002: Move views::Label DisabledColor logic into views::LabelButtonLabel (Closed)
Patch Set: missed-some Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698