Пример #1
0
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();
}
Пример #2
0
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);
    }
}
Пример #3
0
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();
}