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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
6 | 6 |
7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 View* View::GetPreviousFocusableView() { | 1193 View* View::GetPreviousFocusableView() { |
1194 return previous_focusable_view_; | 1194 return previous_focusable_view_; |
1195 } | 1195 } |
1196 | 1196 |
1197 void View::SetNextFocusableView(View* view) { | 1197 void View::SetNextFocusableView(View* view) { |
1198 if (view) | 1198 if (view) |
1199 view->previous_focusable_view_ = this; | 1199 view->previous_focusable_view_ = this; |
1200 next_focusable_view_ = view; | 1200 next_focusable_view_ = view; |
1201 } | 1201 } |
1202 | 1202 |
| 1203 void View::SetFocusable(bool focusable) { |
| 1204 if (focusable_ == focusable) |
| 1205 return; |
| 1206 |
| 1207 focusable_ = focusable; |
| 1208 } |
| 1209 |
1203 bool View::IsFocusable() const { | 1210 bool View::IsFocusable() const { |
1204 return focusable_ && enabled_ && IsDrawn(); | 1211 return focusable_ && enabled_ && IsDrawn(); |
1205 } | 1212 } |
1206 | 1213 |
1207 bool View::IsAccessibilityFocusable() const { | 1214 bool View::IsAccessibilityFocusable() const { |
1208 return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); | 1215 return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn(); |
1209 } | 1216 } |
1210 | 1217 |
| 1218 void View::SetAccessibilityFocusable(bool accessibility_focusable) { |
| 1219 if (accessibility_focusable_ == accessibility_focusable) |
| 1220 return; |
| 1221 |
| 1222 accessibility_focusable_ = accessibility_focusable; |
| 1223 } |
| 1224 |
1211 FocusManager* View::GetFocusManager() { | 1225 FocusManager* View::GetFocusManager() { |
1212 Widget* widget = GetWidget(); | 1226 Widget* widget = GetWidget(); |
1213 return widget ? widget->GetFocusManager() : NULL; | 1227 return widget ? widget->GetFocusManager() : NULL; |
1214 } | 1228 } |
1215 | 1229 |
1216 const FocusManager* View::GetFocusManager() const { | 1230 const FocusManager* View::GetFocusManager() const { |
1217 const Widget* widget = GetWidget(); | 1231 const Widget* widget = GetWidget(); |
1218 return widget ? widget->GetFocusManager() : NULL; | 1232 return widget ? widget->GetFocusManager() : NULL; |
1219 } | 1233 } |
1220 | 1234 |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 // Message the RootView to do the drag and drop. That way if we're removed | 2395 // Message the RootView to do the drag and drop. That way if we're removed |
2382 // the RootView can detect it and avoid calling us back. | 2396 // the RootView can detect it and avoid calling us back. |
2383 gfx::Point widget_location(event.location()); | 2397 gfx::Point widget_location(event.location()); |
2384 ConvertPointToWidget(this, &widget_location); | 2398 ConvertPointToWidget(this, &widget_location); |
2385 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2399 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2386 // WARNING: we may have been deleted. | 2400 // WARNING: we may have been deleted. |
2387 return true; | 2401 return true; |
2388 } | 2402 } |
2389 | 2403 |
2390 } // namespace views | 2404 } // namespace views |
OLD | NEW |