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

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 11411358: LabelButton: Set the label's disabled status to match that of the button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/button/label_button.h" 5 #include "ui/views/controls/button/label_button.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "ui/base/animation/throb_animation.h" 9 #include "ui/base/animation/throb_animation.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 void LabelButton::StateChanged() { 150 void LabelButton::StateChanged() {
151 const gfx::Size previous_image_size(image_->GetPreferredSize()); 151 const gfx::Size previous_image_size(image_->GetPreferredSize());
152 image_->SetImage(GetImage(state())); 152 image_->SetImage(GetImage(state()));
153 const SkColor color = button_state_colors_[state()]; 153 const SkColor color = button_state_colors_[state()];
154 if (state() != STATE_DISABLED && label_->enabled_color() != color) 154 if (state() != STATE_DISABLED && label_->enabled_color() != color)
155 label_->SetEnabledColor(color); 155 label_->SetEnabledColor(color);
156 label_->SetEnabled(state() != STATE_DISABLED);
156 if (image_->GetPreferredSize() != previous_image_size) 157 if (image_->GetPreferredSize() != previous_image_size)
157 Layout(); 158 Layout();
158 } 159 }
159 160
160 gfx::Size LabelButton::GetPreferredSize() { 161 gfx::Size LabelButton::GetPreferredSize() {
161 gfx::Size size(label_->GetPreferredSize()); 162 gfx::Size size(label_->GetPreferredSize());
162 const gfx::Size image_size(image_->GetPreferredSize()); 163 const gfx::Size image_size(image_->GetPreferredSize());
163 if (image_size.width() > 0 && size.width() > 0) 164 if (image_size.width() > 0 && size.width() > 0)
164 size.Enlarge(kSpacing, 0); 165 size.Enlarge(kSpacing, 0);
165 size.set_height(std::max(size.height(), image_size.height())); 166 size.set_height(std::max(size.height(), image_size.height()));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 params->button.indeterminate = false; 278 params->button.indeterminate = false;
278 params->button.is_default = default_button(); 279 params->button.is_default = default_button();
279 params->button.is_focused = HasFocus() && IsAccessibilityFocusable(); 280 params->button.is_focused = HasFocus() && IsAccessibilityFocusable();
280 params->button.has_border = native_theme(); 281 params->button.has_border = native_theme();
281 params->button.classic_state = 0; 282 params->button.classic_state = 0;
282 params->button.background_color = GetNativeTheme()->GetSystemColor( 283 params->button.background_color = GetNativeTheme()->GetSystemColor(
283 ui::NativeTheme::kColorId_TextButtonBackgroundColor); 284 ui::NativeTheme::kColorId_TextButtonBackgroundColor);
284 } 285 }
285 286
286 } // namespace views 287 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698