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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 // Returns the View that either currently has focus, or if no view has focus | 211 // Returns the View that either currently has focus, or if no view has focus |
207 // the view that last had focus. | 212 // the view that last had focus. |
208 View* GetStoredFocusView(); | 213 View* GetStoredFocusView(); |
209 | 214 |
210 // Clears the stored focused view. | 215 // Clears the stored focused view. |
211 void ClearStoredFocusedView(); | 216 void ClearStoredFocusedView(); |
212 | 217 |
213 // Returns true if in the process of changing the focused view. | 218 // Returns true if in the process of changing the focused view. |
214 bool is_changing_focus() const { return is_changing_focus_; } | 219 bool is_changing_focus() const { return is_changing_focus_; } |
215 | 220 |
221 // Moves the text input focus into/out from |view|. | |
msw
2014/03/12 20:56:15
nit: now that these are public, group them with On
Yuki
2014/03/14 15:25:22
Done.
| |
222 void FocusTextInputClient(View* view); | |
223 void BlurTextInputClient(View* view); | |
224 | |
216 // Disable shortcut handling. | 225 // Disable shortcut handling. |
217 static void set_shortcut_handling_suspended(bool suspended) { | 226 static void set_shortcut_handling_suspended(bool suspended) { |
218 shortcut_handling_suspended_ = suspended; | 227 shortcut_handling_suspended_ = suspended; |
219 } | 228 } |
220 // Returns whether shortcut handling is currently suspended. | 229 // Returns whether shortcut handling is currently suspended. |
221 bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } | 230 bool shortcut_handling_suspended() { return shortcut_handling_suspended_; } |
222 | 231 |
223 // Register a keyboard accelerator for the specified target. If multiple | 232 // Register a keyboard accelerator for the specified target. If multiple |
224 // targets are registered for an accelerator, a target registered later has | 233 // targets are registered for an accelerator, a target registered later has |
225 // higher priority. | 234 // higher priority. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |