| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/button/checkbox.h" | 5 #include "views/controls/button/checkbox.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
| 9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "views/controls/label.h" | 10 #include "views/controls/label.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 extra)); | 293 extra)); |
| 294 gfx::Insets insets = GetInsets(); | 294 gfx::Insets insets = GetInsets(); |
| 295 int y_offset = (height() - size.height()) / 2; | 295 int y_offset = (height() - size.height()) / 2; |
| 296 gfx::Rect rect(insets.left(), y_offset, size.width(), size.height()); | 296 gfx::Rect rect(insets.left(), y_offset, size.width(), size.height()); |
| 297 rect.set_x(GetMirroredXForRect(rect)); | 297 rect.set_x(GetMirroredXForRect(rect)); |
| 298 return rect; | 298 return rect; |
| 299 } | 299 } |
| 300 | 300 |
| 301 void Checkbox::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { | 301 void Checkbox::GetExtraParams(gfx::NativeTheme::ExtraParams* params) const { |
| 302 TextButtonBase::GetExtraParams(params); | 302 TextButtonBase::GetExtraParams(params); |
| 303 params->button.is_default = false; | |
| 304 params->button.checked = checked_; | 303 params->button.checked = checked_; |
| 305 } | 304 } |
| 306 | 305 |
| 307 gfx::Rect Checkbox::GetTextBounds() const { | 306 gfx::Rect Checkbox::GetTextBounds() const { |
| 308 gfx::Rect bounds(TextButtonBase::GetTextBounds()); | 307 gfx::Rect bounds(TextButtonBase::GetTextBounds()); |
| 309 gfx::NativeTheme::ExtraParams extra; | 308 gfx::NativeTheme::ExtraParams extra; |
| 310 gfx::NativeTheme::State state = GetThemeState(&extra); | 309 gfx::NativeTheme::State state = GetThemeState(&extra); |
| 311 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), | 310 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), |
| 312 state, | 311 state, |
| 313 extra)); | 312 extra)); |
| 314 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); | 313 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); |
| 315 return bounds; | 314 return bounds; |
| 316 } | 315 } |
| 317 | 316 |
| 318 } // namespace views | 317 } // namespace views |
| OLD | NEW |