2016-01-13 09:29:09 -05:00
|
|
|
#pragma once
|
2015-06-05 16:50:52 -04:00
|
|
|
|
2019-05-14 16:23:47 -04:00
|
|
|
#include <unordered_set>
|
2015-07-07 10:01:17 -04:00
|
|
|
#include "src/widgets/widget.h"
|
|
|
|
|
|
|
|
class FilePane : public wxTreeListCtrl {
|
2015-06-05 16:50:52 -04:00
|
|
|
public:
|
2019-03-20 16:49:25 -04:00
|
|
|
explicit FilePane(
|
2015-07-07 10:01:17 -04:00
|
|
|
wxWindow *parent,
|
|
|
|
wxWindowID id=wxID_ANY,
|
|
|
|
const wxPoint &pos=wxDefaultPosition,
|
|
|
|
const wxSize &size=wxDefaultSize,
|
|
|
|
long style=wxTL_DEFAULT_STYLE,
|
|
|
|
const wxString &name=wxTreeListCtrlNameStr
|
2015-06-05 16:50:52 -04:00
|
|
|
);
|
2019-03-20 16:49:25 -04:00
|
|
|
~FilePane() override;
|
2019-05-24 16:16:40 -04:00
|
|
|
void CreateTree(const wxString &path);
|
2015-06-05 16:50:52 -04:00
|
|
|
private:
|
2019-05-23 16:22:49 -04:00
|
|
|
wxString base_path = "";
|
2015-07-07 10:01:17 -04:00
|
|
|
wxImageList *img_list = nullptr;
|
2019-05-14 16:23:47 -04:00
|
|
|
unordered_set<std::string> file_set;
|
|
|
|
unordered_set<std::string> dir_set;
|
2015-10-22 11:06:34 -04:00
|
|
|
void BindEvents();
|
|
|
|
void OpenFolder(wxTreeListEvent& event);
|
2019-03-20 16:49:25 -04:00
|
|
|
void OpenFileInEditor(wxTreeListEvent& event);
|
2015-07-07 10:01:17 -04:00
|
|
|
void InitImageList();
|
2019-05-30 15:09:42 -04:00
|
|
|
void AddDirToTree(wxTreeListItem &root, const wxString &path, const wxString &parent, bool recurse = false);
|
2019-05-31 14:17:30 -04:00
|
|
|
void AddDirFiles(wxTreeListItem &root, const wxString &path, wxArrayString *files);
|
2015-06-05 16:50:52 -04:00
|
|
|
};
|
|
|
|
|