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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 const char* Checkbox::GetClassName() const { | 119 const char* Checkbox::GetClassName() const { |
120 return kViewClassName; | 120 return kViewClassName; |
121 } | 121 } |
122 | 122 |
123 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 123 void Checkbox::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
124 LabelButton::GetAccessibleNodeData(node_data); | 124 LabelButton::GetAccessibleNodeData(node_data); |
125 node_data->role = ui::AX_ROLE_CHECK_BOX; | 125 node_data->role = ui::AX_ROLE_CHECK_BOX; |
126 if (checked()) | 126 if (checked()) |
127 node_data->AddStateFlag(ui::AX_STATE_CHECKED); | 127 node_data->AddStateFlag(ui::AX_STATE_CHECKED); |
| 128 if (enabled()) { |
| 129 if (checked()) { |
| 130 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, |
| 131 ui::AX_SUPPORTED_ACTION_UNCHECK); |
| 132 } else { |
| 133 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, |
| 134 ui::AX_SUPPORTED_ACTION_CHECK); |
| 135 } |
| 136 } |
128 } | 137 } |
129 | 138 |
130 void Checkbox::OnPaint(gfx::Canvas* canvas) { | 139 void Checkbox::OnPaint(gfx::Canvas* canvas) { |
131 LabelButton::OnPaint(canvas); | 140 LabelButton::OnPaint(canvas); |
132 | 141 |
133 if (!UseMd() || !HasFocus()) | 142 if (!UseMd() || !HasFocus()) |
134 return; | 143 return; |
135 | 144 |
136 SkPaint focus_paint; | 145 SkPaint focus_paint; |
137 focus_paint.setAntiAlias(true); | 146 focus_paint.setAntiAlias(true); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 ui::NativeTheme::Part Checkbox::GetThemePart() const { | 232 ui::NativeTheme::Part Checkbox::GetThemePart() const { |
224 return ui::NativeTheme::kCheckbox; | 233 return ui::NativeTheme::kCheckbox; |
225 } | 234 } |
226 | 235 |
227 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 236 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
228 LabelButton::GetExtraParams(params); | 237 LabelButton::GetExtraParams(params); |
229 params->button.checked = checked_; | 238 params->button.checked = checked_; |
230 } | 239 } |
231 | 240 |
232 } // namespace views | 241 } // namespace views |
OLD | NEW |