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| | |
msw
2014/03/11 00:58:50
nit: Mention that views should call this when thei
Yuki
2014/03/11 15:27:37
Done.
| |
160 // is focused. | |
161 void OnTextInputClientChanged(View* view); | |
162 | |
159 // Returns true is the specified is part of the hierarchy of the window | 163 // Returns true is the specified is part of the hierarchy of the window |
160 // associated with this FocusManager. | 164 // associated with this FocusManager. |
161 bool ContainsView(View* view); | 165 bool ContainsView(View* view); |
162 | 166 |
163 // Advances the focus (backward if reverse is true). | 167 // Advances the focus (backward if reverse is true). |
164 void AdvanceFocus(bool reverse); | 168 void AdvanceFocus(bool reverse); |
165 | 169 |
166 // The FocusManager keeps track of the focused view within a RootView. | 170 // The FocusManager keeps track of the focused view within a RootView. |
167 View* GetFocusedView() { return focused_view_; } | 171 View* GetFocusedView() { return focused_view_; } |
168 const View* GetFocusedView() const { return focused_view_; } | 172 const View* GetFocusedView() const { return focused_view_; } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 // hierarchy. | 329 // hierarchy. |
326 // Returns NULL if no focusable view were found. | 330 // Returns NULL if no focusable view were found. |
327 View* FindFocusableView(FocusTraversable* focus_traversable, | 331 View* FindFocusableView(FocusTraversable* focus_traversable, |
328 View* starting_view, | 332 View* starting_view, |
329 bool reverse); | 333 bool reverse); |
330 | 334 |
331 // Process arrow key traversal. Returns true if the event has been consumed | 335 // Process arrow key traversal. Returns true if the event has been consumed |
332 // and should not be processed further. | 336 // and should not be processed further. |
333 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); | 337 bool ProcessArrowKeyTraversal(const ui::KeyEvent& event); |
334 | 338 |
339 // Moves the text input focus into/out from |view|. | |
340 void FocusTextInputClient(View* view); | |
341 void BlurTextInputClient(View* view); | |
342 | |
335 // Keeps track of whether shortcut handling is currently suspended. | 343 // Keeps track of whether shortcut handling is currently suspended. |
336 static bool shortcut_handling_suspended_; | 344 static bool shortcut_handling_suspended_; |
337 | 345 |
338 // Whether arrow key traversal is enabled. | 346 // Whether arrow key traversal is enabled. |
339 static bool arrow_key_traversal_enabled_; | 347 static bool arrow_key_traversal_enabled_; |
340 | 348 |
341 // The top-level Widget this FocusManager is associated with. | 349 // The top-level Widget this FocusManager is associated with. |
342 Widget* widget_; | 350 Widget* widget_; |
343 | 351 |
344 // The object which handles an accelerator when |accelerator_manager_| doesn't | 352 // The object which handles an accelerator when |accelerator_manager_| doesn't |
(...skipping 18 matching lines...) Expand all Loading... | |
363 | 371 |
364 // See description above getter. | 372 // See description above getter. |
365 bool is_changing_focus_; | 373 bool is_changing_focus_; |
366 | 374 |
367 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 375 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
368 }; | 376 }; |
369 | 377 |
370 } // namespace views | 378 } // namespace views |
371 | 379 |
372 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ | 380 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ |
OLD | NEW |