wxTreeItemId PHPFileLayoutTree::RecurseSearch(const wxTreeItemId& item, const wxString& word) { if(!item.IsOk()) return wxTreeItemId(); if(item != GetRootItem()) { wxString curtext = GetItemText(item); curtext.MakeLower(); if(curtext.StartsWith(word)) { return item; } } if(ItemHasChildren(item)) { wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(item, cookie); while(child.IsOk()) { wxTreeItemId selection = RecurseSearch(child, word); if(selection.IsOk()) { return selection; } child = GetNextChild(item, cookie); } } return wxTreeItemId(); }
void PHPFileLayoutTree::FindWord(const wxString& word) { wxString lcword = word; lcword.MakeLower(); wxTreeItemId item = RecurseSearch(GetRootItem(), lcword); if(item.IsOk()) { SelectItem(item); EnsureVisible(item); ScrollTo(item); } }
wxTreeItemId PHPFileLayoutTree::RecurseSearch(const wxTreeItemId& item, const wxString& word) { if(!item.IsOk()) return wxTreeItemId(); if(item != GetRootItem()) { if(FileUtils::FuzzyMatch(word, GetItemText(item))) { return item; } } if(ItemHasChildren(item)) { wxTreeItemIdValue cookie; wxTreeItemId child = GetFirstChild(item, cookie); while(child.IsOk()) { wxTreeItemId selection = RecurseSearch(child, word); if(selection.IsOk()) { return selection; } child = GetNextChild(item, cookie); } } return wxTreeItemId(); }