| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SEARCH_H_ | 5 #ifndef UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ |
| 6 #define UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ | 6 #define UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Constructor. | 29 // Constructor. |
| 30 // - |root| is the root of the view hierarchy to traverse. Focus will be | 30 // - |root| is the root of the view hierarchy to traverse. Focus will be |
| 31 // trapped inside. | 31 // trapped inside. |
| 32 // - |cycle| should be true if you want FindNextFocusableView to cycle back | 32 // - |cycle| should be true if you want FindNextFocusableView to cycle back |
| 33 // to the first view within this root when the traversal reaches | 33 // to the first view within this root when the traversal reaches |
| 34 // the end. If this is true, then if you pass a valid starting | 34 // the end. If this is true, then if you pass a valid starting |
| 35 // view to FindNextFocusableView you will always get a valid view | 35 // view to FindNextFocusableView you will always get a valid view |
| 36 // out, even if it's the same view. | 36 // out, even if it's the same view. |
| 37 // - |accessibility_mode| should be true if full keyboard accessibility is | 37 // - |accessibility_mode| should be true if full keyboard accessibility is |
| 38 // needed and you want to check IsAccessibilityFocusableInRootView(), | 38 // needed and you want to check IsAccessibilityFocusable(), rather than |
| 39 // rather than IsFocusable(). | 39 // IsFocusable(). |
| 40 FocusSearch(View* root, bool cycle, bool accessibility_mode); | 40 FocusSearch(View* root, bool cycle, bool accessibility_mode); |
| 41 virtual ~FocusSearch() {} | 41 virtual ~FocusSearch() {} |
| 42 | 42 |
| 43 // Finds the next view that should be focused and returns it. If a | 43 // Finds the next view that should be focused and returns it. If a |
| 44 // FocusTraversable is found while searching for the focusable view, | 44 // FocusTraversable is found while searching for the focusable view, |
| 45 // returns NULL and sets |focus_traversable| to the FocusTraversable | 45 // returns NULL and sets |focus_traversable| to the FocusTraversable |
| 46 // and |focus_traversable_view| to the view associated with the | 46 // and |focus_traversable_view| to the view associated with the |
| 47 // FocusTraversable. | 47 // FocusTraversable. |
| 48 // | 48 // |
| 49 // Return NULL if the end of the focus loop is reached, unless this object | 49 // Return NULL if the end of the focus loop is reached, unless this object |
| (...skipping 18 matching lines...) Expand all Loading... |
| 68 bool check_starting_view, | 68 bool check_starting_view, |
| 69 FocusTraversable** focus_traversable, | 69 FocusTraversable** focus_traversable, |
| 70 View** focus_traversable_view); | 70 View** focus_traversable_view); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 // Convenience method that returns true if a view is focusable and does not | 73 // Convenience method that returns true if a view is focusable and does not |
| 74 // belong to the specified group. | 74 // belong to the specified group. |
| 75 bool IsViewFocusableCandidate(View* v, int skip_group_id); | 75 bool IsViewFocusableCandidate(View* v, int skip_group_id); |
| 76 | 76 |
| 77 // Convenience method; returns true if a view is not NULL and is focusable | 77 // Convenience method; returns true if a view is not NULL and is focusable |
| 78 // (checking IsAccessibilityFocusableInRootView() if accessibility_mode_ is | 78 // (checking IsAccessibilityFocusable() if |accessibility_mode_| is true). |
| 79 // true). | |
| 80 bool IsFocusable(View* v); | 79 bool IsFocusable(View* v); |
| 81 | 80 |
| 82 // Returns the view selected for the group of the selected view. If the view | 81 // Returns the view selected for the group of the selected view. If the view |
| 83 // does not belong to a group or if no view is selected in the group, the | 82 // does not belong to a group or if no view is selected in the group, the |
| 84 // specified view is returned. | 83 // specified view is returned. |
| 85 View* FindSelectedViewForGroup(View* view); | 84 View* FindSelectedViewForGroup(View* view); |
| 86 | 85 |
| 87 // Get the parent, but stay within the root. Returns NULL if asked for | 86 // Get the parent, but stay within the root. Returns NULL if asked for |
| 88 // the parent of root_. | 87 // the parent of root_. |
| 89 View* GetParent(View* view); | 88 View* GetParent(View* view); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 113 View* root_; | 112 View* root_; |
| 114 bool cycle_; | 113 bool cycle_; |
| 115 bool accessibility_mode_; | 114 bool accessibility_mode_; |
| 116 | 115 |
| 117 DISALLOW_COPY_AND_ASSIGN(FocusSearch); | 116 DISALLOW_COPY_AND_ASSIGN(FocusSearch); |
| 118 }; | 117 }; |
| 119 | 118 |
| 120 } // namespace views | 119 } // namespace views |
| 121 | 120 |
| 122 #endif // UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ | 121 #endif // UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ |
| OLD | NEW |