fix GetPaths() and GetFilenames() too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1082,42 +1082,42 @@ wxFileName wxGenericFileCtrl::DoGetFileName() const
|
|||||||
|
|
||||||
void wxGenericFileCtrl::DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const
|
void wxGenericFileCtrl::DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const
|
||||||
{
|
{
|
||||||
filenames.Empty();
|
filenames.clear();
|
||||||
|
|
||||||
const wxString dir = m_list->GetDir();
|
const wxString dir = m_list->GetDir();
|
||||||
const wxString value = m_text->GetValue();
|
|
||||||
|
|
||||||
|
const wxString value = m_text->GetValue();
|
||||||
if ( !value.empty() )
|
if ( !value.empty() )
|
||||||
{
|
{
|
||||||
if ( fullPath )
|
wxFileName fn(value);
|
||||||
filenames.Add( dir + value );
|
if ( fn.IsRelative() )
|
||||||
else
|
fn.MakeAbsolute(dir);
|
||||||
filenames.Add( value );
|
|
||||||
|
filenames.push_back(fullPath ? fn.GetFullPath() : fn.GetFullName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_list->GetSelectedItemCount() == 0 )
|
const int numSel = m_list->GetSelectedItemCount();
|
||||||
{
|
if ( !numSel )
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
filenames.Alloc( m_list->GetSelectedItemCount() );
|
filenames.reserve(numSel);
|
||||||
|
|
||||||
wxListItem item;
|
wxListItem item;
|
||||||
item.m_mask = wxLIST_MASK_TEXT;
|
item.m_mask = wxLIST_MASK_TEXT;
|
||||||
|
item.m_itemId = -1;
|
||||||
item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
for ( ;; )
|
||||||
while ( item.m_itemId != -1 )
|
|
||||||
{
|
{
|
||||||
m_list->GetItem( item );
|
item.m_itemId = m_list->GetNextItem(item.m_itemId, wxLIST_NEXT_ALL,
|
||||||
|
wxLIST_STATE_SELECTED);
|
||||||
|
|
||||||
if ( fullPath )
|
if ( item.m_itemId == -1 )
|
||||||
filenames.Add( dir + item.m_text );
|
break;
|
||||||
else
|
|
||||||
filenames.Add( item.m_text );
|
|
||||||
|
|
||||||
item.m_itemId = m_list->GetNextItem( item.m_itemId,
|
m_list->GetItem(item);
|
||||||
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
|
|
||||||
|
const wxFileName fn(dir, item.m_text);
|
||||||
|
filenames.push_back(fullPath ? fn.GetFullPath() : fn.GetFullName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user