MCPcopy Create free account
hub / github.com/SOUI2/soui / FindPreviousFocusableViewImpl

Method FindPreviousFocusableViewImpl

SOUI/src/core/FocusManager.cpp:137–172  ·  view source on GitHub ↗

Strategy for finding the previous focusable view: - keep going down on the right until you reach a view with no children, if it it is a good candidate return it. - start the search on the left sibling. - if there are no left sibling, start the search on the parent (without going down).

Source from the content-addressed store, hash-verified

135 // - if there are no left sibling, start the search on the parent (without going
136 // down).
137 SWindow* FocusSearch::FindPreviousFocusableViewImpl( SWindow* starting_view, bool check_starting_view, bool can_go_up, bool can_go_down, SWindow * pSkipGroupOwner )
138 {
139 if(can_go_down)
140 {//find the last focusable window
141 SWindow *pChild = starting_view->GetWindow(GSW_LASTCHILD);
142 if(pChild)
143 {
144 SWindow *pRet = FindPreviousFocusableViewImpl(pChild,true,false,true,pSkipGroupOwner);
145 if(pRet) return pRet;
146 }
147 }
148
149 if(check_starting_view && IsViewFocusableCandidate(starting_view,pSkipGroupOwner))
150 {
151 SWindow* v = starting_view->GetSelectedSiblingInGroup();
152 if(!v) v = starting_view;
153 // The selected view might not be focusable (if it is disabled for example).
154 if(IsFocusable(v))
155 {
156 return v;
157 }
158 }
159
160 SWindow *pPrevSibling=starting_view->GetWindow(GSW_PREVSIBLING);
161 if(pPrevSibling)
162 {
163 return FindPreviousFocusableViewImpl(pPrevSibling,true,true,true,pSkipGroupOwner);
164 }
165 if(can_go_up)
166 {
167 SWindow *pParent=starting_view->GetWindow(GSW_PARENT);
168 if(pParent) return FindPreviousFocusableViewImpl(pParent,true,true,false,pSkipGroupOwner);
169 }
170
171 return NULL;
172 }
173
174 bool FocusSearch::IsViewFocusableCandidate( SWindow* v,SWindow *pGroupOwner )
175 {

Callers

nothing calls this directly

Calls 3

IsFocusableFunction · 0.85
GetWindowMethod · 0.45

Tested by

no test coverage detected