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

Unified Diff: views/controls/button/custom_button.cc

Issue 6976048: views: Add OnEnabledChanged() method to View class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove View:: prefix, reverse condition Created 9 years, 7 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: views/controls/button/custom_button.cc
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 95ecb988c478c34c3b293bdea1bc9afe1e1c8462..a9a346d59ad55cd98d9ae37fb44b019df7c4a349 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -91,11 +91,11 @@ bool CustomButton::IsHotTracked() const {
return state_ == BS_HOT;
}
-void CustomButton::SetEnabled(bool enabled) {
- if (enabled ? (state_ != BS_DISABLED) : (state_ == BS_DISABLED))
+void CustomButton::OnEnabledChanged() {
+ if (IsEnabled() ? (state_ != BS_DISABLED) : (state_ == BS_DISABLED))
return;
- if (enabled)
+ if (IsEnabled())
SetState(IsMouseHovered() ? BS_HOT : BS_NORMAL);
else
SetState(BS_DISABLED);
@@ -196,7 +196,7 @@ bool CustomButton::OnKeyReleased(const KeyEvent& event) {
}
bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) {
- if (!enabled_)
+ if (!IsEnabled())
return false;
SetState(BS_NORMAL);

Powered by Google App Engine
This is Rietveld 408576698