| 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 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // when traversing up from the nested RootView to know which view to start | 65 // when traversing up from the nested RootView to know which view to start |
| 66 // with when going to the next/previous view. | 66 // with when going to the next/previous view. |
| 67 // In our example: | 67 // In our example: |
| 68 // hwnd_view_container_->GetWidget()->SetFocusTraversableParent( | 68 // hwnd_view_container_->GetWidget()->SetFocusTraversableParent( |
| 69 // native_control); | 69 // native_control); |
| 70 // | 70 // |
| 71 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView | 71 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView |
| 72 // is FocusTraversable. | 72 // is FocusTraversable. |
| 73 | 73 |
| 74 namespace ui { | 74 namespace ui { |
| 75 class AcceleratorManager; |
| 75 class AcceleratorTarget; | 76 class AcceleratorTarget; |
| 76 class AcceleratorManager; | |
| 77 class EventHandler; | 77 class EventHandler; |
| 78 class KeyEvent; | 78 class KeyEvent; |
| 79 } | 79 } |
| 80 | 80 |
| 81 namespace views { | 81 namespace views { |
| 82 | 82 |
| 83 class FocusManagerDelegate; | 83 class FocusManagerDelegate; |
| 84 class FocusSearch; | 84 class FocusSearch; |
| 85 class RootView; | 85 class RootView; |
| 86 class View; | 86 class View; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 FocusManager(Widget* widget, FocusManagerDelegate* delegate); | 151 FocusManager(Widget* widget, FocusManagerDelegate* delegate); |
| 152 virtual ~FocusManager(); | 152 virtual ~FocusManager(); |
| 153 | 153 |
| 154 // Processes the passed key event for accelerators and keyboard traversal. | 154 // Processes the passed key event for accelerators and keyboard traversal. |
| 155 // Returns false if the event has been consumed and should not be processed | 155 // Returns false if the event has been consumed and should not be processed |
| 156 // further. | 156 // further. |
| 157 bool OnKeyEvent(const ui::KeyEvent& event); | 157 bool OnKeyEvent(const ui::KeyEvent& event); |
| 158 | 158 |
| 159 // Changes the text input focus to |view->GetTextInputClient()| iff |view| |
| 160 // is focused. Views must call this method when their internal |
| 161 // TextInputClient instance changes. |
| 162 void OnTextInputClientChanged(View* view); |
| 163 |
| 159 // Returns true is the specified is part of the hierarchy of the window | 164 // Returns true is the specified is part of the hierarchy of the window |
| 160 // associated with this FocusManager. | 165 // associated with this FocusManager. |
| 161 bool ContainsView(View* view); | 166 bool ContainsView(View* view); |
| 162 | 167 |
| 163 // Advances the focus (backward if reverse is true). | 168 // Advances the focus (backward if reverse is true). |
| 164 void AdvanceFocus(bool reverse); | 169 void AdvanceFocus(bool reverse); |
| 165 | 170 |
| 166 // The FocusManager keeps track of the focused view within a RootView. | 171 // The FocusManager keeps track of the focused view within a RootView. |
| 167 View* GetFocusedView() { return focused_view_; } | 172 View* GetFocusedView() { return focused_view_; } |
| 168 const View* GetFocusedView() const { return focused_view_; } | 173 const View* GetFocusedView() const { return focused_view_; } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 // hierarchy. | 330 // hierarchy. |
| 326 // Returns NULL if no focusable view were found. | 331 // Returns NULL if no focusable view were found. |
| 327 View* FindFocusableView(FocusTraversable* focus_traversable, | 332 View* FindFocusableView(FocusTraversable* focus_traversable, |
| 328 View* starting_view, | 333 View* starting_view, |
| 329 bool reverse); | 334 bool reverse); |
| 330 | 335 |
| 331 // Process arrow key traversal. Returns true if the event has been consumed | 336 // Process arrow key traversal. Returns true if the event has been consumed |
| 332 // and should not be processed further. | 337 // and should not be processed further. |
| 333 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); | 338 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); |
| 334 | 339 |
| 340 // Moves the text input focus into/out from |view|. |
| 341 void FocusTextInputClient(View* view); |
| 342 void BlurTextInputClient(View* view); |
| 343 |
| 335 // Keeps track of whether shortcut handling is currently suspended. | 344 // Keeps track of whether shortcut handling is currently suspended. |
| 336 static bool shortcut_handling_suspended_; | 345 static bool shortcut_handling_suspended_; |
| 337 | 346 |
| 338 // Whether arrow key traversal is enabled. | 347 // Whether arrow key traversal is enabled. |
| 339 static bool arrow_key_traversal_enabled_; | 348 static bool arrow_key_traversal_enabled_; |
| 340 | 349 |
| 341 // The top-level Widget this FocusManager is associated with. | 350 // The top-level Widget this FocusManager is associated with. |
| 342 Widget* widget_; | 351 Widget* widget_; |
| 343 | 352 |
| 344 // The object which handles an accelerator when |accelerator_manager_| doesn't | 353 // The object which handles an accelerator when |accelerator_manager_| doesn't |
| (...skipping 18 matching lines...) Expand all Loading... |
| 363 | 372 |
| 364 // See description above getter. | 373 // See description above getter. |
| 365 bool is_changing_focus_; | 374 bool is_changing_focus_; |
| 366 | 375 |
| 367 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 376 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
| 368 }; | 377 }; |
| 369 | 378 |
| 370 } // namespace views | 379 } // namespace views |
| 371 | 380 |
| 372 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 381 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| OLD | NEW |