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

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

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 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
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/radio_button.h" 5 #include "ui/views/controls/button/radio_button.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 bool RadioButton::IsGroupFocusTraversable() const { 94 bool RadioButton::IsGroupFocusTraversable() const {
95 // When focusing a radio button with tab/shift+tab, only the selected button 95 // When focusing a radio button with tab/shift+tab, only the selected button
96 // from the group should be focused. 96 // from the group should be focused.
97 return false; 97 return false;
98 } 98 }
99 99
100 void RadioButton::OnFocus() { 100 void RadioButton::OnFocus() {
101 Checkbox::OnFocus(); 101 Checkbox::OnFocus();
102 SetChecked(true); 102 SetChecked(true);
103 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 103 ui::MouseEvent event(
104 ui::EventTimeForNow(), 0, 0); 104 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(),
105 0, 0,
106 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
107 ui::PointerEvent::kMousePointerId));
105 LabelButton::NotifyClick(event); 108 LabelButton::NotifyClick(event);
106 } 109 }
107 110
108 void RadioButton::NotifyClick(const ui::Event& event) { 111 void RadioButton::NotifyClick(const ui::Event& event) {
109 // Set the checked state to true only if we are unchecked, since we can't 112 // Set the checked state to true only if we are unchecked, since we can't
110 // be toggled on and off like a checkbox. 113 // be toggled on and off like a checkbox.
111 if (!checked()) 114 if (!checked())
112 SetChecked(true); 115 SetChecked(true);
113 RequestFocus(); 116 RequestFocus();
114 LabelButton::NotifyClick(event); 117 LabelButton::NotifyClick(event);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const cc::PaintFlags& flags) { 154 const cc::PaintFlags& flags) {
152 canvas->DrawCircle(gfx::RectF(image()->bounds()).CenterPoint(), 155 canvas->DrawCircle(gfx::RectF(image()->bounds()).CenterPoint(),
153 image()->width() / 2, flags); 156 image()->width() / 2, flags);
154 } 157 }
155 158
156 const gfx::VectorIcon& RadioButton::GetVectorIcon() const { 159 const gfx::VectorIcon& RadioButton::GetVectorIcon() const {
157 return checked() ? kRadioButtonActiveIcon : kRadioButtonNormalIcon; 160 return checked() ? kRadioButtonActiveIcon : kRadioButtonNormalIcon;
158 } 161 }
159 162
160 } // namespace views 163 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698