-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfiletree.h
More file actions
71 lines (51 loc) · 1.44 KB
/
Copy pathfiletree.h
File metadata and controls
71 lines (51 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include "helper_types.h"
#include "widget.h"
#include <GLFW/glfw3.h>
#include <mutex>
struct TreeStructure {
icu::UnicodeString name;
std::string path;
bool is_folder = false;
std::vector<TreeStructure*> childrenFolders = {};
std::vector<TreeStructure*> childrenFiles = {};
};
struct Visual {
int x;
int y;
int w;
int h;
icu::UnicodeString name;
TreeStructure* ts = nullptr;
bool is_folder = false;
};
class FileTree : public Widget {
public:
FileTree(Widget* parent);
std::mutex tree_mutex;
TreeStructure* root = nullptr;
std::vector<Visual> toRender = {};
std::vector<std::string> openpaths = {};
double scrolled_to_vert = 0; // measured in lines
double scrolled_to_horz = 0;
double max_scroll_vert = 0;
double max_scroll_horz = 0;
bool rounded = true;
Color* back_color;
int elHeighto = 0;
GLuint folderIcon;
GLuint fileIcon;
// bool on_key_event(int key, int scancode, int action, int mods);
bool on_mouse_button_event(int button, int action, int mods);
// bool on_mouse_move_event();
bool on_scroll_event(double xchange, double ychange);
void position(int x, int y, int w, int h);
void render();
void save();
void fillOutTree(TreeStructure* el);
void deleteTree(TreeStructure* el);
double createVisuals(double pos, double depth, TreeStructure* el);
private:
GLuint prepareTexture(std::string imagepath);
void renderTexture(GLuint texID, int x, int y, int w, int h, Color* mainCol);
};