Beispiel #1
0
void
wxGenericFileCtrl::DoGetFilenames(wxArrayString& filenames, bool fullPath) const
{
    filenames.clear();

    const wxString dir = m_list->GetDir();

    const wxString value = m_text->GetValue();
    if ( !value.empty() )
    {
        wxFileName fn(value);
        if ( fn.IsRelative() )
            fn.MakeAbsolute(dir);

        filenames.push_back(GetFileNameOrPath(fn, fullPath));
        return;
    }

    const int numSel = m_list->GetSelectedItemCount();
    if ( !numSel )
        return;

    filenames.reserve(numSel);

    wxListItem item;
    item.m_mask = wxLIST_MASK_TEXT;
    item.m_itemId = -1;
    for ( ;; )
    {
        item.m_itemId = m_list->GetNextItem(item.m_itemId, wxLIST_NEXT_ALL,
                                            wxLIST_STATE_SELECTED);

        if ( item.m_itemId == -1 )
            break;

        m_list->GetItem(item);

        const wxFileName fn(dir, item.m_text);
        filenames.push_back(GetFileNameOrPath(fn, fullPath));
    }
}