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:
@@ -163,9 +163,13 @@ public:
|
|||||||
virtual void ReCreateTree();
|
virtual void ReCreateTree();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ExpandDir(wxTreeItemId parentId);
|
virtual void ExpandDir(wxTreeItemId parentId);
|
||||||
void CollapseDir(wxTreeItemId parentId);
|
virtual void CollapseDir(wxTreeItemId parentId);
|
||||||
void AddSection(const wxString& path, const wxString& name, int imageId = 0);
|
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);
|
//void FindChildFiles(wxTreeItemId id, int dirFlags, wxArrayString& filenames);
|
||||||
|
|
||||||
// Extract description and actual filter from overall filter string
|
// Extract description and actual filter from overall filter string
|
||||||
|
@@ -529,13 +529,16 @@ void wxGenericDirCtrl::ShowHidden( bool show )
|
|||||||
SetPath(path);
|
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);
|
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);
|
m_treeCtrl->SetItemHasChildren(id);
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGenericDirCtrl::SetupSections()
|
void wxGenericDirCtrl::SetupSections()
|
||||||
@@ -755,7 +758,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
|||||||
path += eachFilename;
|
path += eachFilename;
|
||||||
|
|
||||||
wxDirItemData *dir_item = new wxDirItemData(path,eachFilename,TRUE);
|
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);
|
wxFileIconsTable::folder, -1, dir_item);
|
||||||
m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open,
|
m_treeCtrl->SetItemImage( id, wxFileIconsTable::folder_open,
|
||||||
wxTreeItemIcon_Expanded );
|
wxTreeItemIcon_Expanded );
|
||||||
@@ -787,7 +790,7 @@ void wxGenericDirCtrl::ExpandDir(wxTreeItemId parentId)
|
|||||||
int image_id = wxFileIconsTable::file;
|
int image_id = wxFileIconsTable::file;
|
||||||
if (eachFilename.Find(wxT('.')) != wxNOT_FOUND)
|
if (eachFilename.Find(wxT('.')) != wxNOT_FOUND)
|
||||||
image_id = wxTheFileIconsTable->GetIconID(eachFilename.AfterLast(wxT('.')));
|
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();
|
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
|
// wxDirFilterListCtrl
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1157,6 +1180,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFileIconsTable icons
|
// wxFileIconsTable icons
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user