]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirctrlg.cpp
Allow passing multi-line strings to wxDC::DrawText(), even under MSW.
[wxWidgets.git] / src / generic / dirctrlg.cpp
index 9bb119ebea1bc63dca59e602ed82108c275f8be8..46b72cf08a1b86b096affc7d900e575ed47bcbc1 100644 (file)
@@ -785,19 +785,12 @@ void wxGenericDirCtrl::CollapseDir(wxTreeItemId parentId)
         return;
 
     data->m_isExpanded = false;
-    wxTreeItemIdValue cookie;
-    /* Workaround because DeleteChildren has disapeared (why?) and
-     * CollapseAndReset doesn't work as advertised (deletes parent too) */
-    child = m_treeCtrl->GetFirstChild(parentId, cookie);
-    while (child.IsOk())
-    {
-        m_treeCtrl->Delete(child);
-        /* Not GetNextChild below, because the cookie mechanism can't
-         * handle disappearing children! */
-        child = m_treeCtrl->GetFirstChild(parentId, cookie);
-    }
+
+    m_treeCtrl->Freeze();
     if (parentId != m_treeCtrl->GetRootItem())
-        m_treeCtrl->Collapse(parentId);
+        m_treeCtrl->CollapseAndReset(parentId);
+    m_treeCtrl->DeleteChildren(parentId);
+    m_treeCtrl->Thaw();
 }
 
 void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
@@ -1179,12 +1172,7 @@ void wxGenericDirCtrl::SelectPath(const wxString& path, bool select)
 
     if ( done )
     {
-        if(select && m_treeCtrl->IsSelected(id))
-            return;
-        else
-        {
-            m_treeCtrl->SelectItem(id, select);
-        }
+        m_treeCtrl->SelectItem(id, select);
     }
 }
 
@@ -1426,7 +1414,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
 
 #ifndef __WXGTK20__
 /* Computer (c) Julian Smart */
-static const char * file_icons_tbl_computer_xpm[] = {
+static const char* const file_icons_tbl_computer_xpm[] = {
 /* columns rows colors chars-per-pixel */
 "16 16 42 1",
 "r c #4E7FD0",
@@ -1508,11 +1496,7 @@ public:
     bool OnInit() { wxTheFileIconsTable = new wxFileIconsTable; return true; }
     void OnExit()
     {
-        if (wxTheFileIconsTable)
-        {
-            delete wxTheFileIconsTable;
-            wxTheFileIconsTable = NULL;
-        }
+        wxDELETE(wxTheFileIconsTable);
     }
 };
 
@@ -1587,14 +1571,14 @@ void wxFileIconsTable::Create()
                                                    wxART_CMN_DIALOG,
                                                    wxSize(16, 16)));
     // executable
-    if (GetIconID(wxEmptyString, _T("application/x-executable")) == file)
+    if (GetIconID(wxEmptyString, wxT("application/x-executable")) == file)
     {
         m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE,
                                                        wxART_CMN_DIALOG,
                                                        wxSize(16, 16)));
-        delete m_HashTable->Get(_T("exe"));
-        m_HashTable->Delete(_T("exe"));
-        m_HashTable->Put(_T("exe"), new wxFileIconEntry(executable));
+        delete m_HashTable->Get(wxT("exe"));
+        m_HashTable->Delete(wxT("exe"));
+        m_HashTable->Put(wxT("exe"), new wxFileIconEntry(executable));
     }
     /* else put into list by GetIconID
        (KDE defines application/x-executable for *.exe and has nice icon)