X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bf9e3e736771b247eb38ada221266733b6a601c7..fed628b632d8ae95efded1f6a6894573c7a76bef:/src/generic/filedlgg.cpp diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 9f1eaee5c0..78ceba169a 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -244,14 +244,14 @@ void wxFileData::SetNewName( const wxString &name, const wxString &fname ) void wxFileData::MakeItem( wxListItem &item ) { item.m_text = m_name; - item.m_colour = wxBLACK; - if (IsExe()) item.m_colour = wxRED; - if (IsDir()) item.m_colour = wxBLUE; - if (IsDir()) item.m_image = 0; else item.m_image = -1; + item.ClearAttributes(); + if (IsExe()) item.SetTextColour(*wxRED); + if (IsDir()) item.SetTextColour(*wxBLUE); + item.m_image = IsDir() ? 0 : -1; if (IsLink()) { wxColour *dg = wxTheColourDatabase->FindColour( "MEDIUM GREY" ); - item.m_colour = dg; + item.SetTextColour(*dg); } item.m_data = (long)this; } @@ -574,6 +574,10 @@ wxFileDialog::wxFileDialog(wxWindow *parent, m_message = message; m_dialogStyle = style; + + if ((m_dialogStyle & wxMULTIPLE ) && !(m_dialogStyle & wxOPEN)) + m_dialogStyle |= wxOPEN; + m_dir = defaultDir; if (m_dir.IsEmpty()) { @@ -657,8 +661,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent, staticsizer->Add( m_static, 1 ); mainsizer->Add( staticsizer, 0, wxEXPAND | wxLEFT|wxRIGHT|wxBOTTOM, 10 ); - m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, wxSize(440,180), - wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL ); + if (m_dialogStyle & wxMULTIPLE) + m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, + wxSize(440,180), wxLC_LIST | wxSUNKEN_BORDER ); + else + m_list = new wxFileCtrl( this, ID_LIST_CTRL, m_dir, firstWild, wxDefaultPosition, + wxSize(440,180), wxLC_LIST | wxSUNKEN_BORDER | wxLC_SINGLE_SEL ); mainsizer->Add( m_list, 1, wxEXPAND | wxLEFT|wxRIGHT, 10 ); wxBoxSizer *textsizer = new wxBoxSizer( wxHORIZONTAL ); @@ -709,6 +717,7 @@ void wxFileDialog::OnChoice( wxCommandEvent &event ) { wxString *str = (wxString*) m_choice->GetClientData( event.GetInt() ); m_list->SetWild( *str ); + m_filterIndex = event.GetInt(); } void wxFileDialog::OnCheck( wxCommandEvent &event ) @@ -889,6 +898,44 @@ void wxFileDialog::SetPath( const wxString& path ) } } +void wxFileDialog::GetPaths( wxArrayString& paths ) const +{ + paths.Empty(); + paths.Alloc( m_list->GetSelectedItemCount() ); + + wxString dir; + m_list->GetDir( dir ); + if (dir != wxT("/")) dir += wxT("/"); + + wxListItem item; + item.m_mask = wxLIST_MASK_TEXT; + + item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + while ( item.m_itemId != -1 ) { + m_list->GetItem( item ); + paths.Add( dir + item.m_text ); + item.m_itemId = m_list->GetNextItem( item.m_itemId + 1, + wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + } +} + +void wxFileDialog::GetFilenames(wxArrayString& files) const +{ + files.Empty(); + files.Alloc( m_list->GetSelectedItemCount() ); + + wxListItem item; + item.m_mask = wxLIST_MASK_TEXT; + + item.m_itemId = m_list->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + while ( item.m_itemId != -1 ) { + m_list->GetItem( item ); + files.Add( item.m_text ); + item.m_itemId = m_list->GetNextItem( item.m_itemId + 1, + wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED ); + } +} + // ---------------------------------------------------------------------------- // global functions // ----------------------------------------------------------------------------