| 15 | } |
| 16 | |
| 17 | SWindow* FocusSearch::FindNextFocusableView( SWindow* starting_view, bool reverse, bool check_starting_view ) |
| 18 | { |
| 19 | if(root_->GetChildrenCount()==0) return NULL; |
| 20 | |
| 21 | if(!starting_view) |
| 22 | { |
| 23 | if(reverse) |
| 24 | { |
| 25 | starting_view=root_->GetWindow(GSW_LASTCHILD); |
| 26 | while(starting_view->GetChildrenCount()) starting_view=starting_view->GetWindow(GSW_LASTCHILD); |
| 27 | }else |
| 28 | { |
| 29 | starting_view=root_->GetWindow(GSW_FIRSTCHILD); |
| 30 | } |
| 31 | check_starting_view=true; |
| 32 | } |
| 33 | |
| 34 | SWindow *pRet=NULL; |
| 35 | SWindow *pStartGroupOwner=NULL; |
| 36 | if(starting_view && starting_view->IsSiblingsAutoGroupped()) |
| 37 | pStartGroupOwner=starting_view->GetParent(); |
| 38 | |
| 39 | if(reverse) |
| 40 | { |
| 41 | bool can_go_down=!IsFocusable(starting_view); |
| 42 | pRet=FindPreviousFocusableViewImpl(starting_view,check_starting_view,true,can_go_down,pStartGroupOwner); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | pRet= FindNextFocusableViewImpl(starting_view,check_starting_view,true,true,pStartGroupOwner); |
| 47 | } |
| 48 | if(!pRet && cycle_ && starting_view) |
| 49 | { |
| 50 | cycle_=false; |
| 51 | pRet=FindNextFocusableView(NULL,reverse,false); |
| 52 | } |
| 53 | return pRet; |
| 54 | } |
| 55 | |
| 56 | // Strategy for finding the next focusable view: |
| 57 | // - keep going down the first child, stop when you find a focusable view or |
no test coverage detected