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

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

Issue 1421713002: Explicitly convert Point to PointF for event code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip
Patch Set: pointfconvert-prod: . Created 5 years, 1 month 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_view_state.h" 8 #include "ui/accessibility/ax_view_state.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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 bool RadioButton::IsGroupFocusTraversable() const { 119 bool RadioButton::IsGroupFocusTraversable() const {
120 // When focusing a radio button with tab/shift+tab, only the selected button 120 // When focusing a radio button with tab/shift+tab, only the selected button
121 // from the group should be focused. 121 // from the group should be focused.
122 return false; 122 return false;
123 } 123 }
124 124
125 void RadioButton::OnFocus() { 125 void RadioButton::OnFocus() {
126 Checkbox::OnFocus(); 126 Checkbox::OnFocus();
127 SetChecked(true); 127 SetChecked(true);
128 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), 128 ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::PointF(), gfx::PointF(),
129 ui::EventTimeForNow(), 0, 0); 129 ui::EventTimeForNow(), 0, 0);
130 LabelButton::NotifyClick(event); 130 LabelButton::NotifyClick(event);
131 } 131 }
132 132
133 void RadioButton::NotifyClick(const ui::Event& event) { 133 void RadioButton::NotifyClick(const ui::Event& event) {
134 // Set the checked state to true only if we are unchecked, since we can't 134 // Set the checked state to true only if we are unchecked, since we can't
135 // be toggled on and off like a checkbox. 135 // be toggled on and off like a checkbox.
136 if (!checked()) 136 if (!checked())
137 SetChecked(true); 137 SetChecked(true);
138 RequestFocus(); 138 RequestFocus();
139 LabelButton::NotifyClick(event); 139 LabelButton::NotifyClick(event);
140 } 140 }
141 141
142 ui::NativeTheme::Part RadioButton::GetThemePart() const { 142 ui::NativeTheme::Part RadioButton::GetThemePart() const {
143 return ui::NativeTheme::kRadio; 143 return ui::NativeTheme::kRadio;
144 } 144 }
145 145
146 } // namespace views 146 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698