| 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 | 7 |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // - |focus_traversable_view| is set to the view associated with the | 61 // - |focus_traversable_view| is set to the view associated with the |
| 62 // FocusTraversable set in the previous parameter (it is used as the | 62 // FocusTraversable set in the previous parameter (it is used as the |
| 63 // starting view when looking for the next focusable view). | 63 // starting view when looking for the next focusable view). |
| 64 virtual View* FindNextFocusableView(View* starting_view, | 64 virtual View* FindNextFocusableView(View* starting_view, |
| 65 bool reverse, | 65 bool reverse, |
| 66 Direction direction, | 66 Direction direction, |
| 67 bool check_starting_view, | 67 bool check_starting_view, |
| 68 FocusTraversable** focus_traversable, | 68 FocusTraversable** focus_traversable, |
| 69 View** focus_traversable_view); | 69 View** focus_traversable_view); |
| 70 | 70 |
| 71 protected: |
| 72 // Get the parent, but stay within the root. Returns NULL if asked for |
| 73 // the parent of |root_|. Subclasses can override this if they need custom |
| 74 // focus search behavior. |
| 75 virtual View* GetParent(View* v); |
| 76 |
| 77 // Returns true if |v| is contained within the hierarchy rooted at |root|. |
| 78 // Subclasses can override this if they need custom focus search behavior. |
| 79 virtual bool Contains(View* root, const View* v); |
| 80 |
| 81 View* root() const { return root_; } |
| 82 |
| 71 private: | 83 private: |
| 72 // Convenience method that returns true if a view is focusable and does not | 84 // Convenience method that returns true if a view is focusable and does not |
| 73 // belong to the specified group. | 85 // belong to the specified group. |
| 74 bool IsViewFocusableCandidate(View* v, int skip_group_id); | 86 bool IsViewFocusableCandidate(View* v, int skip_group_id); |
| 75 | 87 |
| 76 // Convenience method; returns true if a view is not NULL and is focusable | 88 // Convenience method; returns true if a view is not NULL and is focusable |
| 77 // (checking IsAccessibilityFocusable() if |accessibility_mode_| is true). | 89 // (checking IsAccessibilityFocusable() if |accessibility_mode_| is true). |
| 78 bool IsFocusable(View* v); | 90 bool IsFocusable(View* v); |
| 79 | 91 |
| 80 // Returns the view selected for the group of the selected view. If the view | 92 // Returns the view selected for the group of the selected view. If the view |
| 81 // does not belong to a group or if no view is selected in the group, the | 93 // does not belong to a group or if no view is selected in the group, the |
| 82 // specified view is returned. | 94 // specified view is returned. |
| 83 View* FindSelectedViewForGroup(View* view); | 95 View* FindSelectedViewForGroup(View* view); |
| 84 | 96 |
| 85 // Get the parent, but stay within the root. Returns NULL if asked for | |
| 86 // the parent of root_. | |
| 87 View* GetParent(View* view); | |
| 88 | |
| 89 // Returns the next focusable view or view containing a FocusTraversable | 97 // Returns the next focusable view or view containing a FocusTraversable |
| 90 // (NULL if none was found), starting at the starting_view. | 98 // (NULL if none was found), starting at the starting_view. |
| 91 // |check_starting_view|, |can_go_up| and |can_go_down| controls the | 99 // |check_starting_view|, |can_go_up| and |can_go_down| controls the |
| 92 // traversal of the views hierarchy. |skip_group_id| specifies a group_id, | 100 // traversal of the views hierarchy. |skip_group_id| specifies a group_id, |
| 93 // -1 means no group. All views from a group are traversed in one pass. | 101 // -1 means no group. All views from a group are traversed in one pass. |
| 94 View* FindNextFocusableViewImpl(View* starting_view, | 102 View* FindNextFocusableViewImpl(View* starting_view, |
| 95 bool check_starting_view, | 103 bool check_starting_view, |
| 96 bool can_go_up, | 104 bool can_go_up, |
| 97 bool can_go_down, | 105 bool can_go_down, |
| 98 int skip_group_id, | 106 int skip_group_id, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 View* root_; | 119 View* root_; |
| 112 bool cycle_; | 120 bool cycle_; |
| 113 bool accessibility_mode_; | 121 bool accessibility_mode_; |
| 114 | 122 |
| 115 DISALLOW_COPY_AND_ASSIGN(FocusSearch); | 123 DISALLOW_COPY_AND_ASSIGN(FocusSearch); |
| 116 }; | 124 }; |
| 117 | 125 |
| 118 } // namespace views | 126 } // namespace views |
| 119 | 127 |
| 120 #endif // UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ | 128 #endif // UI_VIEWS_FOCUS_FOCUS_SEARCH_H_ |
| OLD | NEW |