| 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 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_ | 5 #ifndef VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| 6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ | 6 #define VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| 7 | 7 |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // and focus_traversable_view should be set to the view associated with the | 100 // and focus_traversable_view should be set to the view associated with the |
| 101 // FocusTraversable. | 101 // FocusTraversable. |
| 102 // This call should return NULL if the end of the focus loop is reached. | 102 // This call should return NULL if the end of the focus loop is reached. |
| 103 // - |starting_view| is the view that should be used as the starting point | 103 // - |starting_view| is the view that should be used as the starting point |
| 104 // when looking for the previous/next view. It may be NULL (in which case | 104 // when looking for the previous/next view. It may be NULL (in which case |
| 105 // the first/last view should be used depending if normal/reverse). | 105 // the first/last view should be used depending if normal/reverse). |
| 106 // - |reverse| whether we should find the next (reverse is false) or the | 106 // - |reverse| whether we should find the next (reverse is false) or the |
| 107 // previous (reverse is true) view. | 107 // previous (reverse is true) view. |
| 108 // - |direction| specifies whether we are traversing down (meaning we should | 108 // - |direction| specifies whether we are traversing down (meaning we should |
| 109 // look into child views) or traversing up (don't look at child views). | 109 // look into child views) or traversing up (don't look at child views). |
| 110 // - |dont_loop| if true specifies that if there is a loop in the focus | 110 // - |check_starting_view| is true if starting_view may obtain the next focus. |
| 111 // hierarchy, we should keep traversing after the last view of the loop. | |
| 112 // - |focus_traversable| is set to the focus traversable that should be | 111 // - |focus_traversable| is set to the focus traversable that should be |
| 113 // traversed if one is found (in which case the call returns NULL). | 112 // traversed if one is found (in which case the call returns NULL). |
| 114 // - |focus_traversable_view| is set to the view associated with the | 113 // - |focus_traversable_view| is set to the view associated with the |
| 115 // FocusTraversable set in the previous parameter (it is used as the | 114 // FocusTraversable set in the previous parameter (it is used as the |
| 116 // starting view when looking for the next focusable view). | 115 // starting view when looking for the next focusable view). |
| 117 | 116 |
| 118 virtual View* FindNextFocusableView(View* starting_view, | 117 virtual View* FindNextFocusableView(View* starting_view, |
| 119 bool reverse, | 118 bool reverse, |
| 120 Direction direction, | 119 Direction direction, |
| 121 bool dont_loop, | 120 bool check_starting_view, |
| 122 FocusTraversable** focus_traversable, | 121 FocusTraversable** focus_traversable, |
| 123 View** focus_traversable_view) = 0; | 122 View** focus_traversable_view) = 0; |
| 124 | 123 |
| 125 // Should return the parent FocusTraversable. | 124 // Should return the parent FocusTraversable. |
| 126 // The top RootView which is the top FocusTraversable returns NULL. | 125 // The top RootView which is the top FocusTraversable returns NULL. |
| 127 virtual FocusTraversable* GetFocusTraversableParent() = 0; | 126 virtual FocusTraversable* GetFocusTraversableParent() = 0; |
| 128 | 127 |
| 129 // This should return the View this FocusTraversable belongs to. | 128 // This should return the View this FocusTraversable belongs to. |
| 130 // It is used when walking up the view hierarchy tree to find which view | 129 // It is used when walking up the view hierarchy tree to find which view |
| 131 // should be used as the starting view for finding the next/previous view. | 130 // should be used as the starting view for finding the next/previous view. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 301 |
| 303 // Returns the last view of the focus traversal hierarchy. | 302 // Returns the last view of the focus traversal hierarchy. |
| 304 View* FindLastFocusableView(); | 303 View* FindLastFocusableView(); |
| 305 | 304 |
| 306 // Returns the focusable view found in the FocusTraversable specified starting | 305 // Returns the focusable view found in the FocusTraversable specified starting |
| 307 // at the specified view. This traverses down along the FocusTraversable | 306 // at the specified view. This traverses down along the FocusTraversable |
| 308 // hierarchy. | 307 // hierarchy. |
| 309 // Returns NULL if no focusable view were found. | 308 // Returns NULL if no focusable view were found. |
| 310 View* FindFocusableView(FocusTraversable* focus_traversable, | 309 View* FindFocusableView(FocusTraversable* focus_traversable, |
| 311 View* starting_view, | 310 View* starting_view, |
| 312 bool reverse, | 311 bool reverse); |
| 313 bool dont_loop); | |
| 314 | 312 |
| 315 // The RootView of the window associated with this FocusManager. | 313 // The RootView of the window associated with this FocusManager. |
| 316 RootView* top_root_view_; | 314 RootView* top_root_view_; |
| 317 | 315 |
| 318 // The view that currently is focused. | 316 // The view that currently is focused. |
| 319 View* focused_view_; | 317 View* focused_view_; |
| 320 | 318 |
| 321 // The storage id used in the ViewStorage to store/restore the view that last | 319 // The storage id used in the ViewStorage to store/restore the view that last |
| 322 // had focus. | 320 // had focus. |
| 323 int stored_focused_view_storage_id_; | 321 int stored_focused_view_storage_id_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 341 // The list of registered FocusChange listeners. | 339 // The list of registered FocusChange listeners. |
| 342 typedef std::vector<FocusChangeListener*> FocusChangeListenerList; | 340 typedef std::vector<FocusChangeListener*> FocusChangeListenerList; |
| 343 FocusChangeListenerList focus_change_listeners_; | 341 FocusChangeListenerList focus_change_listeners_; |
| 344 | 342 |
| 345 DISALLOW_COPY_AND_ASSIGN(FocusManager); | 343 DISALLOW_COPY_AND_ASSIGN(FocusManager); |
| 346 }; | 344 }; |
| 347 | 345 |
| 348 } // namespace views | 346 } // namespace views |
| 349 | 347 |
| 350 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ | 348 #endif // VIEWS_FOCUS_FOCUS_MANAGER_H_ |
| OLD | NEW |