From 5aaf1c1222c440c9c5a3b79c39ceda881660e914 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Tue, 9 Feb 2010 22:33:48 +0000 Subject: Disable lables for disabled checkboxes. Original patch by Philippe Beaudoin (see http://codereview.chromium.org/567026 ), r=ben,me. BUG=22982 TEST=Go to Options->Personal Stuff->Import data from another browser...->From "Google Toolbar". Labels for disabled checkboxes should also look disabled. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38523 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/button/checkbox.cc | 12 +++++++++--- views/controls/button/checkbox.h | 7 ++++--- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'views') diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc index cba0aaf..f4594be 100644 --- a/views/controls/button/checkbox.cc +++ b/views/controls/button/checkbox.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 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. +// Copyright (c) 2010 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. #include "views/controls/button/checkbox.h" @@ -96,6 +96,12 @@ void Checkbox::Layout() { native_wrapper_->GetView()->Layout(); } +void Checkbox::SetEnabled(bool enabled) { + NativeButton::SetEnabled(enabled); + if (label_) + label_->SetEnabled(enabled); +} + void Checkbox::PaintFocusBorder(gfx::Canvas* canvas) { // Our focus border is rendered by the label, so we don't do anything here. } diff --git a/views/controls/button/checkbox.h b/views/controls/button/checkbox.h index e138885..8274070 100644 --- a/views/controls/button/checkbox.h +++ b/views/controls/button/checkbox.h @@ -1,6 +1,6 @@ -// Copyright (c) 2009 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. +// Copyright (c) 2010 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 VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ #define VIEWS_CONTROLS_BUTTON_CHECKBOX_H_ @@ -41,6 +41,7 @@ class Checkbox : public NativeButton { // Overridden from View: virtual gfx::Size GetPreferredSize(); virtual void Layout(); + virtual void SetEnabled(bool enabled); virtual void PaintFocusBorder(gfx::Canvas* canvas); virtual View* GetViewForPoint(const gfx::Point& point); virtual View* GetViewForPoint(const gfx::Point& point, -- cgit v1.1