]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirctrlg.cpp
oops, more fixes needed
[wxWidgets.git] / src / generic / dirctrlg.cpp
index 0193c7e016363d82788086fb215f09d0107161ec..660128edf2d91223705608e6eaa8ba164ae15e15 100644 (file)
@@ -834,16 +834,24 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
         {
             int style = wxDIR_FILES;
             if (m_showHidden) style |= wxDIR_HIDDEN;
-            if (d.GetFirst(& eachFilename, m_currentFilterStr, style))
+            // Process each filter (ex: "JPEG Files (*.jpg;*.jpeg)|*.jpg;*.jpeg")
+            wxStringTokenizer strTok;
+            wxString curFilter;
+            strTok.SetString(m_currentFilterStr,wxT(";"));
+            while(strTok.HasMoreTokens())
             {
-                do
+                curFilter = strTok.GetNextToken();
+                if (d.GetFirst(& eachFilename, m_currentFilterStr, style))
                 {
-                    if ((eachFilename != wxT(".")) && (eachFilename != wxT("..")))
+                    do
                     {
-                        filenames.Add(eachFilename);
+                        if ((eachFilename != wxT(".")) && (eachFilename != wxT("..")))
+                        {
+                            filenames.Add(eachFilename);
+                        }
                     }
+                    while (d.GetNext(& eachFilename));
                 }
-                while (d.GetNext(& eachFilename));
             }
         }
         filenames.Sort(wxDirCtrlStringCompareFunction);
@@ -1633,9 +1641,13 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
 
     wxIconLocation iconLoc;
     wxIcon ic;
-    if ( ft && ft->GetIcon(&iconLoc) )
+
     {
-        ic = wxIcon(iconLoc);
+        wxLogNull logNull;
+        if ( ft && ft->GetIcon(&iconLoc) )
+        {
+            ic = wxIcon(iconLoc);
+        }
     }
 
     delete ft;
@@ -1650,6 +1662,13 @@ int wxFileIconsTable::GetIconID(const wxString& extension, const wxString& mime)
     wxBitmap bmp;
     bmp.CopyFromIcon(ic);
 
+    if ( !bmp.Ok() )
+    {
+        int newid = file;
+        m_HashTable->Put(extension, new wxFileIconEntry(newid));
+        return newid;
+    }
+
     int id = m_smallImageList->GetImageCount();
     if ((bmp.GetWidth() == 16) && (bmp.GetHeight() == 16))
         m_smallImageList->Add(bmp);