First step to new file pane

This commit is contained in:
Tim Warren 2015-07-14 10:40:53 -04:00
parent 4baf41e46b
commit 38eef11db2
2 changed files with 27 additions and 2 deletions

View File

@ -1,5 +1,12 @@
#include "src/widgets/FilePane.h"
enum
{
Icon_File,
Icon_FolderClosed,
Icon_FolderOpened
};
FilePane::FilePane(
wxWindow* parent,
wxWindowID id,
@ -13,14 +20,16 @@ FilePane::FilePane(
this->InitImageList();
this->SetImageList(this->img_list);
this->dir->Open(".");
const wxString defaultPath = wxString(".");
wxTreeListItem root = this->GetRootItem();
this->CreateTree(defaultPath, root);
this->AppendColumn("",
wxCOL_WIDTH_AUTOSIZE,
wxALIGN_LEFT,
wxCOL_RESIZABLE | wxCOL_SORTABLE);
wxTreeListItem root = this->GetRootItem();
}
FilePane::~FilePane()
@ -28,6 +37,21 @@ FilePane::~FilePane()
}
void FilePane::CreateTree(const wxString &path, wxTreeListItem &root)
{
wxString *filename = new wxString("");
this->dir->Open(path);
this->dir->GetFirst(filename, wxEmptyString, wxDIR_DEFAULT | wxDIR_NO_FOLLOW);
this->AppendItem(root, *filename, Icon_FolderClosed, Icon_FolderOpened);
while (this->dir->GetNext(filename))
{
this->AppendItem(root, *filename, Icon_FolderClosed, Icon_FolderOpened);
}
}
void FilePane::InitImageList()
{
wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST);

View File

@ -18,6 +18,7 @@ private:
wxImageList *img_list = nullptr;
wxDir *dir = nullptr;
void InitImageList();
void CreateTree(const wxString &path, wxTreeListItem &root);
};
#endif /* TYRO_FILE_PANE_H */