[studio] Add ability to drag files between directories
All checks were successful
Build / build (push) Successful in 3m29s
All checks were successful
Build / build (push) Successful in 3m29s
This commit is contained in:
@@ -45,6 +45,8 @@ class FileExplorer: public ox::SignalHandler {
|
||||
|
||||
virtual void fileDeleted(ox::StringViewCR path) const noexcept;
|
||||
|
||||
virtual void fileMoved(ox::StringViewCR src, ox::StringViewCR dst) const noexcept;
|
||||
|
||||
void drawFileContextMenu(ox::CStringViewCR path) const noexcept;
|
||||
|
||||
void drawDirContextMenu(ox::CStringViewCR path) const noexcept;
|
||||
|
||||
@@ -41,6 +41,8 @@ void FileExplorer::fileOpened(ox::StringViewCR) const noexcept {}
|
||||
|
||||
void FileExplorer::fileDeleted(ox::StringViewCR) const noexcept {}
|
||||
|
||||
void FileExplorer::fileMoved(ox::StringViewCR, ox::StringViewCR) const noexcept {}
|
||||
|
||||
void FileExplorer::drawFileContextMenu(ox::CStringViewCR path) const noexcept {
|
||||
ig::IDStackItem const idStackItem{path};
|
||||
fileContextMenu(path);
|
||||
@@ -91,6 +93,13 @@ void FileTreeModel::draw(turbine::Context &tctx) const noexcept {
|
||||
}
|
||||
ig::IDStackItem const idStackItem{m_name};
|
||||
m_explorer.drawDirContextMenu(m_fullPath);
|
||||
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
||||
auto const [ref, err] = ig::getDragDropPayload<FileRef>("FileRef");
|
||||
if (!err) {
|
||||
auto const name = substr(ref.path, find(ref.path.rbegin(), ref.path.rend(), '/').offset() + 1);
|
||||
m_explorer.fileMoved(ref.path, sfmt("{}/{}", m_fullPath, name));
|
||||
}
|
||||
}
|
||||
if (nodeOpen) {
|
||||
for (auto const&child : m_children) {
|
||||
child->draw(tctx);
|
||||
|
||||
Reference in New Issue
Block a user