-
Notifications
You must be signed in to change notification settings - Fork 3
/
FolderView.h
54 lines (42 loc) · 1.19 KB
/
FolderView.h
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
#pragma once
#include <vector>
#include <string>
#include "File.h"
#include "Drive.h"
class Ribbon;
using namespace std;
class FolderView:public Control
{
public:
FolderView(Vector2f size);
string getCurrentPath()const;
string getSelectedFilePath()const;
string getSelectedFileName() const;
void loadDirectory(const string path, bool effectRibbon=true);
virtual ~FolderView();
virtual FloatRect getGlobalBounds() const;
virtual Control * handleEvent(Event event, Vector2f mousePos);
virtual Control * clone() const;
void attachRibbon(Ribbon * rb);
void refreshDirectory();
void refreshDrives();
void refresh();
void draw(RenderTarget &target, RenderStates states) const override;
void positionDrives();
void positionFiles();
private:
void loadDrives();
//Graphical
void onClickLeft(const Event::MouseButtonEvent& mouseButton, Vector2f mousePos);
void onBackSpace();
void onMouseMove(const Event::MouseMoveEvent& mouse, Vector2f mousePos);
private:
Clock lastClickTime;
Ribbon* pRibbon;
FloatRect globalBounds;
string currentPath="";
vector<Drive> drives;
vector<File> files;
int selectedFile=-1;
int selectedDrive=-1;
};