OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/view.h" | 5 #include "views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
9 #include <iostream> | 9 #include <iostream> |
10 #endif | 10 #endif |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return widget ? widget->GetFocusManager() : NULL; | 269 return widget ? widget->GetFocusManager() : NULL; |
270 } | 270 } |
271 | 271 |
272 bool View::HasFocus() { | 272 bool View::HasFocus() { |
273 FocusManager* focus_manager = GetFocusManager(); | 273 FocusManager* focus_manager = GetFocusManager(); |
274 if (focus_manager) | 274 if (focus_manager) |
275 return focus_manager->GetFocusedView() == this; | 275 return focus_manager->GetFocusedView() == this; |
276 return false; | 276 return false; |
277 } | 277 } |
278 | 278 |
| 279 void View::Focus() { |
| 280 // Set the native focus to the root view window so it receives the keyboard |
| 281 // messages. |
| 282 FocusManager* focus_manager = GetFocusManager(); |
| 283 if (focus_manager) |
| 284 focus_manager->FocusNativeView(GetRootView()->GetWidget()->GetNativeView()); |
| 285 } |
| 286 |
279 void View::SetHotTracked(bool flag) { | 287 void View::SetHotTracked(bool flag) { |
280 } | 288 } |
281 | 289 |
282 ///////////////////////////////////////////////////////////////////////////// | 290 ///////////////////////////////////////////////////////////////////////////// |
283 // | 291 // |
284 // View - painting | 292 // View - painting |
285 // | 293 // |
286 ///////////////////////////////////////////////////////////////////////////// | 294 ///////////////////////////////////////////////////////////////////////////// |
287 | 295 |
288 void View::SchedulePaint(const gfx::Rect& r, bool urgent) { | 296 void View::SchedulePaint(const gfx::Rect& r, bool urgent) { |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 start_x = start_y = 0; | 1427 start_x = start_y = 0; |
1420 } | 1428 } |
1421 | 1429 |
1422 void View::DragInfo::PossibleDrag(int x, int y) { | 1430 void View::DragInfo::PossibleDrag(int x, int y) { |
1423 possible_drag = true; | 1431 possible_drag = true; |
1424 start_x = x; | 1432 start_x = x; |
1425 start_y = y; | 1433 start_y = y; |
1426 } | 1434 } |
1427 | 1435 |
1428 } // namespace | 1436 } // namespace |
OLD | NEW |