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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 months 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
« no previous file with comments | « ui/views/controls/button/checkbox.h ('k') | ui/views/controls/button/label_button_border.cc » ('j') | 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/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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 } 136 }
137 } 137 }
138 138
139 void Checkbox::OnPaint(gfx::Canvas* canvas) { 139 void Checkbox::OnPaint(gfx::Canvas* canvas) {
140 LabelButton::OnPaint(canvas); 140 LabelButton::OnPaint(canvas);
141 141
142 if (!UseMd() || !HasFocus()) 142 if (!UseMd() || !HasFocus())
143 return; 143 return;
144 144
145 SkPaint focus_paint; 145 cc::PaintFlags focus_paint;
146 focus_paint.setAntiAlias(true); 146 focus_paint.setAntiAlias(true);
147 focus_paint.setColor( 147 focus_paint.setColor(
148 SkColorSetA(GetNativeTheme()->GetSystemColor( 148 SkColorSetA(GetNativeTheme()->GetSystemColor(
149 ui::NativeTheme::kColorId_FocusedBorderColor), 149 ui::NativeTheme::kColorId_FocusedBorderColor),
150 0x66)); 150 0x66));
151 focus_paint.setStyle(SkPaint::kStroke_Style); 151 focus_paint.setStyle(cc::PaintFlags::kStroke_Style);
152 focus_paint.setStrokeWidth(2); 152 focus_paint.setStrokeWidth(2);
153 PaintFocusRing(canvas, focus_paint); 153 PaintFocusRing(canvas, focus_paint);
154 } 154 }
155 155
156 void Checkbox::OnFocus() { 156 void Checkbox::OnFocus() {
157 LabelButton::OnFocus(); 157 LabelButton::OnFocus();
158 if (!UseMd()) 158 if (!UseMd())
159 UpdateImage(); 159 UpdateImage();
160 } 160 }
161 161
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void Checkbox::SetCustomImage(bool checked, 207 void Checkbox::SetCustomImage(bool checked,
208 bool focused, 208 bool focused,
209 ButtonState for_state, 209 ButtonState for_state,
210 const gfx::ImageSkia& image) { 210 const gfx::ImageSkia& image) {
211 const size_t checked_index = checked ? 1 : 0; 211 const size_t checked_index = checked ? 1 : 0;
212 const size_t focused_index = focused ? 1 : 0; 212 const size_t focused_index = focused ? 1 : 0;
213 images_[checked_index][focused_index][for_state] = image; 213 images_[checked_index][focused_index][for_state] = image;
214 UpdateImage(); 214 UpdateImage();
215 } 215 }
216 216
217 void Checkbox::PaintFocusRing(gfx::Canvas* canvas, const SkPaint& paint) { 217 void Checkbox::PaintFocusRing(gfx::Canvas* canvas,
218 const cc::PaintFlags& paint) {
218 gfx::RectF focus_rect(image()->bounds()); 219 gfx::RectF focus_rect(image()->bounds());
219 canvas->DrawRoundRect(focus_rect, 2.f, paint); 220 canvas->DrawRoundRect(focus_rect, 2.f, paint);
220 } 221 }
221 222
222 const gfx::VectorIcon& Checkbox::GetVectorIcon() const { 223 const gfx::VectorIcon& Checkbox::GetVectorIcon() const {
223 return checked() ? kCheckboxActiveIcon : kCheckboxNormalIcon; 224 return checked() ? kCheckboxActiveIcon : kCheckboxNormalIcon;
224 } 225 }
225 226
226 void Checkbox::NotifyClick(const ui::Event& event) { 227 void Checkbox::NotifyClick(const ui::Event& event) {
227 SetChecked(!checked()); 228 SetChecked(!checked());
228 LabelButton::NotifyClick(event); 229 LabelButton::NotifyClick(event);
229 } 230 }
230 231
231 ui::NativeTheme::Part Checkbox::GetThemePart() const { 232 ui::NativeTheme::Part Checkbox::GetThemePart() const {
232 return ui::NativeTheme::kCheckbox; 233 return ui::NativeTheme::kCheckbox;
233 } 234 }
234 235
235 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { 236 void Checkbox::GetExtraParams(ui::NativeTheme::ExtraParams* params) const {
236 LabelButton::GetExtraParams(params); 237 LabelButton::GetExtraParams(params);
237 params->button.checked = checked_; 238 params->button.checked = checked_;
238 } 239 }
239 240
240 } // namespace views 241 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/checkbox.h ('k') | ui/views/controls/button/label_button_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698