Applied patch [ 623187 ] virtual methods and new AppendItem

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20821 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2003-06-01 15:48:42 +00:00
parent b544a27802
commit 22328fa444
2 changed files with 35 additions and 7 deletions

View File

@ -163,9 +163,13 @@ public:
virtual void ReCreateTree();
protected:
void ExpandDir(wxTreeItemId parentId);
void CollapseDir(wxTreeItemId parentId);
void AddSection(const wxString& path, const wxString& name, int imageId = 0);
virtual void ExpandDir(wxTreeItemId parentId);
virtual void CollapseDir(wxTreeItemId parentId);
virtual const wxTreeItemId AddSection(const wxString& path, const wxString& name, int imageId = 0);
virtual wxTreeItemId AppendItem (const wxTreeItemId & parent,
const wxString & text,
int image = -1, int selectedImage = -1,
wxTreeItemData * data = NULL);
//void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames);
// Extract description and actual filter from overall filter string

View File

@ -529,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()
@ -755,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 );
@ -787,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);
}
}
}
@ -1102,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
//-----------------------------------------------------------------------------
@ -1157,6 +1180,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
}
}
// ----------------------------------------------------------------------------
// wxFileIconsTable icons
// ----------------------------------------------------------------------------