OLD | NEW |
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/checkbox.h" | 5 #include "ui/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 "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) { | 62 void Checkbox::OnPaintFocusBorder(gfx::Canvas* canvas) { |
63 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | 63 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { |
64 gfx::Rect bounds(GetTextBounds()); | 64 gfx::Rect bounds(GetTextBounds()); |
65 // Increate the bounding box by one on each side so that that focus border | 65 // Increate the bounding box by one on each side so that that focus border |
66 // does not draw on top of the letters. | 66 // does not draw on top of the letters. |
67 bounds.Inset(-1, -1, -1, -1); | 67 bounds.Inset(-1, -1, -1, -1); |
68 canvas->DrawFocusRect(bounds); | 68 canvas->DrawFocusRect(bounds); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void Checkbox::NotifyClick(const views::Event& event) { | 72 void Checkbox::NotifyClick(const ui::Event& event) { |
73 SetChecked(!checked()); | 73 SetChecked(!checked()); |
74 RequestFocus(); | 74 RequestFocus(); |
75 TextButtonBase::NotifyClick(event); | 75 TextButtonBase::NotifyClick(event); |
76 } | 76 } |
77 | 77 |
78 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 78 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
79 return ui::NativeTheme::kCheckbox; | 79 return ui::NativeTheme::kCheckbox; |
80 } | 80 } |
81 | 81 |
82 gfx::Rect Checkbox::GetThemePaintRect() const { | 82 gfx::Rect Checkbox::GetThemePaintRect() const { |
(...skipping 17 matching lines...) Expand all Loading... |
100 gfx::Rect bounds(TextButtonBase::GetTextBounds()); | 100 gfx::Rect bounds(TextButtonBase::GetTextBounds()); |
101 ui::NativeTheme::ExtraParams extra; | 101 ui::NativeTheme::ExtraParams extra; |
102 ui::NativeTheme::State state = GetThemeState(&extra); | 102 ui::NativeTheme::State state = GetThemeState(&extra); |
103 gfx::Size size(ui::NativeTheme::instance()->GetPartSize(GetThemePart(), state, | 103 gfx::Size size(ui::NativeTheme::instance()->GetPartSize(GetThemePart(), state, |
104 extra)); | 104 extra)); |
105 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); | 105 bounds.Offset(size.width() + kCheckboxLabelSpacing, 0); |
106 return bounds; | 106 return bounds; |
107 } | 107 } |
108 | 108 |
109 } // namespace views | 109 } // namespace views |
OLD | NEW |