Tyro/src/widgets/FileTreePane.h

31 lines
891 B
C
Raw Normal View History

2016-01-13 09:29:09 -05:00
#pragma once
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 FileTreePane : public wxTreeListCtrl {
public:
explicit FileTreePane(
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
);
~FileTreePane() override;
void CreateTree(const wxString &path);
private:
2019-05-23 16:22:49 -04:00
wxString base_path = "";
2015-07-07 10:01:17 -04:00
wxImageList *img_list = nullptr;
unordered_set<string> file_set;
unordered_set<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();
void AddDirToTree(wxTreeListItem &root, const wxString &path, const wxString &parent, bool recurse = false);
void AddDirFiles(wxTreeListItem &root, const wxString &path, wxArrayString *files);
};