Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: ui/views/focus/focus_manager.h

Issue 10825254: Remove views::KeyEvent, replacing uses of it with ui::KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/focus/accelerator_handler_win.cc ('k') | ui/views/focus/focus_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // In our example: 68 // In our example:
69 // hwnd_view_container_->GetWidget()->SetFocusTraversableParent( 69 // hwnd_view_container_->GetWidget()->SetFocusTraversableParent(
70 // native_control); 70 // native_control);
71 // 71 //
72 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView 72 // Note that FocusTraversable do not have to be RootViews: AccessibleToolbarView
73 // is FocusTraversable. 73 // is FocusTraversable.
74 74
75 namespace ui { 75 namespace ui {
76 class AcceleratorTarget; 76 class AcceleratorTarget;
77 class AcceleratorManager; 77 class AcceleratorManager;
78 class KeyEvent;
78 } 79 }
79 80
80 namespace views { 81 namespace views {
81 82
82 class FocusManagerDelegate; 83 class FocusManagerDelegate;
83 class FocusSearch; 84 class FocusSearch;
84 class RootView; 85 class RootView;
85 class View; 86 class View;
86 class Widget; 87 class Widget;
87 88
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // a particular view. 136 // a particular view.
136 kReasonDirectFocusChange 137 kReasonDirectFocusChange
137 }; 138 };
138 139
139 FocusManager(Widget* widget, FocusManagerDelegate* delegate); 140 FocusManager(Widget* widget, FocusManagerDelegate* delegate);
140 virtual ~FocusManager(); 141 virtual ~FocusManager();
141 142
142 // Processes the passed key event for accelerators and tab traversal. 143 // Processes the passed key event for accelerators and tab traversal.
143 // Returns false if the event has been consumed and should not be processed 144 // Returns false if the event has been consumed and should not be processed
144 // further. 145 // further.
145 bool OnKeyEvent(const KeyEvent& event); 146 bool OnKeyEvent(const ui::KeyEvent& event);
146 147
147 // Returns true is the specified is part of the hierarchy of the window 148 // Returns true is the specified is part of the hierarchy of the window
148 // associated with this FocusManager. 149 // associated with this FocusManager.
149 bool ContainsView(View* view); 150 bool ContainsView(View* view);
150 151
151 // Advances the focus (backward if reverse is true). 152 // Advances the focus (backward if reverse is true).
152 void AdvanceFocus(bool reverse); 153 void AdvanceFocus(bool reverse);
153 154
154 // The FocusManager keeps track of the focused view within a RootView. 155 // The FocusManager keeps track of the focused view within a RootView.
155 View* GetFocusedView() { return focused_view_; } 156 View* GetFocusedView() { return focused_view_; }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // Activate the target associated with the specified accelerator. 226 // Activate the target associated with the specified accelerator.
226 // First, AcceleratorPressed handler of the most recently registered target 227 // First, AcceleratorPressed handler of the most recently registered target
227 // is called, and if that handler processes the event (i.e. returns true), 228 // is called, and if that handler processes the event (i.e. returns true),
228 // this method immediately returns. If not, we do the same thing on the next 229 // this method immediately returns. If not, we do the same thing on the next
229 // target, and so on. 230 // target, and so on.
230 // Returns true if an accelerator was activated. 231 // Returns true if an accelerator was activated.
231 bool ProcessAccelerator(const ui::Accelerator& accelerator); 232 bool ProcessAccelerator(const ui::Accelerator& accelerator);
232 233
233 // Resets menu key state if |event| is not menu key release. 234 // Resets menu key state if |event| is not menu key release.
234 // This is effective only on x11. 235 // This is effective only on x11.
235 void MaybeResetMenuKeyState(const KeyEvent& key); 236 void MaybeResetMenuKeyState(const ui::KeyEvent& key);
236 237
237 // Called by a RootView when a view within its hierarchy is removed 238 // Called by a RootView when a view within its hierarchy is removed
238 // from its parent. This will only be called by a RootView in a 239 // from its parent. This will only be called by a RootView in a
239 // hierarchy of Widgets that this FocusManager is attached to the 240 // hierarchy of Widgets that this FocusManager is attached to the
240 // parent Widget of. 241 // parent Widget of.
241 void ViewRemoved(View* removed); 242 void ViewRemoved(View* removed);
242 243
243 // Adds/removes a listener. The FocusChangeListener is notified every time 244 // Adds/removes a listener. The FocusChangeListener is notified every time
244 // the focused view is about to change. 245 // the focused view is about to change.
245 void AddFocusChangeListener(FocusChangeListener* listener); 246 void AddFocusChangeListener(FocusChangeListener* listener);
246 void RemoveFocusChangeListener(FocusChangeListener* listener); 247 void RemoveFocusChangeListener(FocusChangeListener* listener);
247 248
248 // Returns the AcceleratorTarget that should be activated for the specified 249 // Returns the AcceleratorTarget that should be activated for the specified
249 // keyboard accelerator, or NULL if no view is registered for that keyboard 250 // keyboard accelerator, or NULL if no view is registered for that keyboard
250 // accelerator. 251 // accelerator.
251 ui::AcceleratorTarget* GetCurrentTargetForAccelerator( 252 ui::AcceleratorTarget* GetCurrentTargetForAccelerator(
252 const ui::Accelerator& accelertor) const; 253 const ui::Accelerator& accelertor) const;
253 254
254 // Whether the given |accelerator| has a priority handler associated with it. 255 // Whether the given |accelerator| has a priority handler associated with it.
255 bool HasPriorityHandler(const ui::Accelerator& accelerator) const; 256 bool HasPriorityHandler(const ui::Accelerator& accelerator) const;
256 257
257 // Clears the native view having the focus. 258 // Clears the native view having the focus.
258 virtual void ClearNativeFocus(); 259 virtual void ClearNativeFocus();
259 260
260 // Convenience method that returns true if the passed |key_event| should 261 // Convenience method that returns true if the passed |key_event| should
261 // trigger tab traversal (if it is a TAB key press with or without SHIFT 262 // trigger tab traversal (if it is a TAB key press with or without SHIFT
262 // pressed). 263 // pressed).
263 static bool IsTabTraversalKeyEvent(const KeyEvent& key_event); 264 static bool IsTabTraversalKeyEvent(const ui::KeyEvent& key_event);
264 265
265 private: 266 private:
266 // Returns the next focusable view. 267 // Returns the next focusable view.
267 View* GetNextFocusableView(View* starting_view, bool reverse, bool dont_loop); 268 View* GetNextFocusableView(View* starting_view, bool reverse, bool dont_loop);
268 269
269 // Returns the focusable view found in the FocusTraversable specified starting 270 // Returns the focusable view found in the FocusTraversable specified starting
270 // at the specified view. This traverses down along the FocusTraversable 271 // at the specified view. This traverses down along the FocusTraversable
271 // hierarchy. 272 // hierarchy.
272 // Returns NULL if no focusable view were found. 273 // Returns NULL if no focusable view were found.
273 View* FindFocusableView(FocusTraversable* focus_traversable, 274 View* FindFocusableView(FocusTraversable* focus_traversable,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 308
308 // See description above getter. 309 // See description above getter.
309 bool is_changing_focus_; 310 bool is_changing_focus_;
310 311
311 DISALLOW_COPY_AND_ASSIGN(FocusManager); 312 DISALLOW_COPY_AND_ASSIGN(FocusManager);
312 }; 313 };
313 314
314 } // namespace views 315 } // namespace views
315 316
316 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_ 317 #endif // UI_VIEWS_FOCUS_FOCUS_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/views/focus/accelerator_handler_win.cc ('k') | ui/views/focus/focus_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698