65 lines
1.1 KiB
C++
65 lines
1.1 KiB
C++
#include "dl_ui_file_explorer.h"
|
|
|
|
#ifndef DL_DISABLE_RENDER
|
|
namespace dl::UI
|
|
{
|
|
void FileExplorer::Update()
|
|
{
|
|
Window::Update();
|
|
|
|
Value v = _lstPath->GetSelectClickDouble();
|
|
if (v)
|
|
{
|
|
std::string path = v.ToString();
|
|
if (path.empty())
|
|
;
|
|
else if (path == "../")
|
|
{
|
|
_pathCurrent = File::GetParentPath(_pathCurrent);
|
|
Refresh();
|
|
}
|
|
else if (path.back() == '/')
|
|
{
|
|
_pathCurrent += path;
|
|
Refresh();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Value v_root = _lstPathRoot->GetSelectClick();
|
|
if (v_root)
|
|
{
|
|
std::string path = v_root.ToString();
|
|
if (path.empty())
|
|
;
|
|
else if (path.back() == '/')
|
|
{
|
|
_pathCurrent = path;
|
|
Refresh();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void FileExplorer::Refresh()
|
|
{
|
|
//
|
|
_txtPath->SetString(_pathCurrent);
|
|
//
|
|
_vecPath.clear();
|
|
_vecPath.push_back("../");
|
|
File::GetPathContent(_pathCurrent, _vecPath, _targetName, true, !_bOnlyFolder);
|
|
for (auto& iter : _vecPath)
|
|
{
|
|
iter = String::ErasePath(iter, _pathCurrent);
|
|
}
|
|
_lstPath->SetItemData(_vecPath);
|
|
//
|
|
_vecPathRoot = File::PathRegular();
|
|
_lstPathRoot->SetItemData(_vecPathRoot);
|
|
}
|
|
|
|
}
|
|
#endif
|
|
|