Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Created January 19, 2019 05:54
Show Gist options
  • Save SunXiaoShan/2a17a9593c7ee672d05dd839fd4df7df to your computer and use it in GitHub Desktop.
Save SunXiaoShan/2a17a9593c7ee672d05dd839fd4df7df to your computer and use it in GitHub Desktop.
bool moveHighlight(DirectionType direction) {
bool moved = false;
Widget *currentHighlightedWidget = getHighlightedWidget();
// 若目前沒有 highlight,嘗試尋找一個可以被 highlight 的物件
if (NULL == currentHighlightedWidget) {
setupHighlighted();
moved = hasHighlightedWidget();
return moved;
}
// 尋找若以該 Parent Widget 作為 panel,上面是否含有可以被 highlight 的 Widget
Widget* parentWidget = currentHighlightedWidget->parentWidget;
if (!moved) {
moved = parentWidget->moveHighlight( direction );
}
// 若在沒有,則尋找若以該 Widget 作為 panel,上面是否含有可以被 highlight 的 Widget
if (!moved) {
moved = widget->moveHighlight( aDirection );
}
return moved;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment