X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2dd62dc00816faec94ea118d5a3bacaf07d88acf..fe97acf0e3b423984fb615c0ce060d9f00f6f0f8:/src/generic/dirctrlg.cpp diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index eb633d9568..dbaaf19a54 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -1107,7 +1107,7 @@ wxString wxGenericDirCtrl::GetPath() const wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id); return data->m_path; } - + return wxEmptyString; } @@ -1395,16 +1395,33 @@ void wxDirFilterListCtrl::OnSelFilter(wxCommandEvent& WXUNUSED(event)) { int sel = GetSelection(); - wxString currentPath = m_dirCtrl->GetPath(); + if (m_dirCtrl->HasFlag(wxDIRCTRL_MULTIPLE)) + { + wxArrayString paths; + m_dirCtrl->GetPaths(paths); - m_dirCtrl->SetFilterIndex(sel); + m_dirCtrl->SetFilterIndex(sel); - // If the filter has changed, the view is out of date, so - // collapse the tree. - m_dirCtrl->ReCreateTree(); + // If the filter has changed, the view is out of date, so + // collapse the tree. + m_dirCtrl->ReCreateTree(); - // Try to restore the selection, or at least the directory - m_dirCtrl->ExpandPath(currentPath); + // Expand and select the previously selected paths + for (unsigned int i = 0; i < paths.GetCount(); i++) + { + m_dirCtrl->ExpandPath(paths.Item(i)); + } + } + else + { + wxString currentPath = m_dirCtrl->GetPath(); + + m_dirCtrl->SetFilterIndex(sel); + m_dirCtrl->ReCreateTree(); + + // Try to restore the selection, or at least the directory + m_dirCtrl->ExpandPath(currentPath); + } } void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilter)