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

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

Issue 2913933002: Move views::Label DisabledColor logic into views::LabelButtonLabel (Closed)
Patch Set: Back to PatchSet 11 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..16577261cc8a03975ad4e9ab281a7c109a08f109
--- /dev/null
+++ b/ui/views/controls/button/label_button_label.h
@@ -0,0 +1,48 @@
+// 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"
+#include "ui/views/views_export.h"
+
+namespace views {
+
+// A Label subclass that can be disabled. This is only used internally for
+// views::LabelButton.
+class VIEWS_EXPORT LabelButtonLabel : public Label {
+ public:
+ LabelButtonLabel(const base::string16& text, int text_context);
+ ~LabelButtonLabel() override;
+
+ // Set an explicit disabled color. This will stop the Label responding to
+ // changes in the native theme for disabled colors.
+ void SetDisabledColor(SkColor color);
+
+ // Label:
+ void SetEnabledColor(SkColor color) override;
+
+ protected:
+ // Label:
+ void OnEnabledChanged() override;
+ void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
+
+ private:
+ void SetColorForEnableState();
+
+ SkColor requested_disabled_color_ = SK_ColorRED;
+ SkColor requested_enabled_color_ = SK_ColorRED;
+ bool disabled_color_set_ = false;
+ bool enabled_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