]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dirctrlg.cpp
adapting MacHandleControlClick to know about mouse state
[wxWidgets.git] / src / generic / dirctrlg.cpp
index b42f9d6d9ee0a19f81421dbe1eb061d7841234ad..566662567fc497904d83b0208c1495ee43cd0628 100644 (file)
@@ -459,10 +459,14 @@ bool wxGenericDirCtrl::Create(wxWindow *parent,
 
     if ((style & wxDIRCTRL_3D_INTERNAL) == 0)
         treeStyle |= wxNO_BORDER;
+    else
+        treeStyle |= wxBORDER_SUNKEN;
 
     long filterStyle = 0;
     if ((style & wxDIRCTRL_3D_INTERNAL) == 0)
         filterStyle |= wxNO_BORDER;
+    else
+        filterStyle |= wxBORDER_SUNKEN;
 
     m_treeCtrl = new wxTreeCtrl(this, wxID_TREECTRL, pos, size, treeStyle);
 
@@ -525,13 +529,16 @@ void wxGenericDirCtrl::ShowHidden( bool show )
     SetPath(path);
 }
 
-void wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
+const wxTreeItemId
+wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
 {
     wxDirItemData *dir_item = new wxDirItemData(path,name,TRUE);
 
-    wxTreeItemId id = m_treeCtrl->AppendItem( m_rootId, name, imageId, -1, dir_item);
+    wxTreeItemId id = AppendItem( m_rootId, name, imageId, -1, dir_item);
 
     m_treeCtrl->SetItemHasChildren(id);
+
+    return id;
 }
 
 void wxGenericDirCtrl::SetupSections()
@@ -751,7 +758,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
         path += eachFilename;
 
         wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,TRUE);
-        wxTreeItemId id = m_treeCtrl->AppendItem( parentId, eachFilename,
+        wxTreeItemId id = AppendItem( parentId, eachFilename,
                                       wxFileIconsTable::folder, -1, dir_item);
         m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open,
                                   wxTreeItemIcon_Expanded );
@@ -783,7 +790,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
             int image_id = wxFileIconsTable::file;
             if (eachFilename.Find(wxT('.')) != wxNOT_FOUND)
                 image_id = wxTheFileIconsTable->GetIconID(eachFilename.AfterLast(wxT('.')));
-            (void)m_treeCtrl->AppendItem( parentId, eachFilename, image_id, -1, dir_item);
+            (void) AppendItem( parentId, eachFilename, image_id, -1, dir_item);
         }
     }
 }
@@ -1098,6 +1105,26 @@ void wxGenericDirCtrl::OnSize(wxSizeEvent& WXUNUSED(event))
     DoResize();
 }
 
+wxTreeItemId wxGenericDirCtrl::AppendItem (const wxTreeItemId & parent,
+                                          const wxString & text,
+                                          int image, int selectedImage,
+                                          wxTreeItemData * data)
+{
+  wxTreeCtrl *treeCtrl = GetTreeCtrl ();
+
+  wxASSERT (treeCtrl);
+
+  if (treeCtrl)
+  {
+    return treeCtrl->AppendItem (parent, text, image, selectedImage, data);
+  }
+  else
+  {
+    return wxTreeItemId();
+  }
+}
+
+
 //-----------------------------------------------------------------------------
 // wxDirFilterListCtrl
 //-----------------------------------------------------------------------------
@@ -1153,6 +1180,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
     }
 }
 
+
 // ----------------------------------------------------------------------------
 // wxFileIconsTable icons
 // ----------------------------------------------------------------------------
@@ -1375,7 +1403,6 @@ wxFileIconsTable::~wxFileIconsTable()
 void wxFileIconsTable::Create()
 {
     wxCHECK_RET(!m_smallImageList && !m_HashTable, wxT("creating icons twice"));
-printf("creating \n"); fflush(stdout);
     m_HashTable = new wxHashTable(wxKEY_STRING);
     m_smallImageList = new wxImageList(16, 16);