Chromium Code Reviews| 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_; |
| 304 #if defined(OS_WIN) | |
| 305 params->button.classic_state |= checked_ ? DFCS_CHECKED: 0; | |
|
Ben Goodger (Google)
2011/06/23 17:31:34
Can't this be added automatically by the NativeThe
Roger Tawa OOO till Jul 10th
2011/06/23 19:22:11
You are correct, it can.
| |
| 306 #endif | |
| 305 } | 307 } |
| 306 | 308 |
| 307 gfx::Rect Checkbox::GetTextBounds() const { | 309 gfx::Rect Checkbox::GetTextBounds() const { |
| 308 gfx::Rect bounds(TextButtonBase::GetTextBounds()); | 310 gfx::Rect bounds(TextButtonBase::GetTextBounds()); |
| 309 gfx::NativeTheme::ExtraParams extra; | 311 gfx::NativeTheme::ExtraParams extra; |
| 310 gfx::NativeTheme::State state = GetThemeState(&extra); | 312 gfx::NativeTheme::State state = GetThemeState(&extra); |
| 311 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), | 313 gfx::Size size(gfx::NativeTheme::instance()->GetPartSize(GetThemePart(), |
| 312 state, | 314 state, |
| 313 extra)); | 315 extra)); |
| 314 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); | 316 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); |
| 315 return bounds; | 317 return bounds; |
| 316 } | 318 } |
| 317 | 319 |
| 318 } // namespace views | 320 } // namespace views |
| OLD | NEW |