[studio] Complete drag/drop support for files
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <studio/dragdrop.hpp>
|
||||
#include <studio/imguiutil.hpp>
|
||||
|
||||
#include "projectexplorer.hpp"
|
||||
@ -54,8 +55,9 @@ void ProjectTreeModel::draw(turbine::Context &tctx) const noexcept {
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::TreePop();
|
||||
ig::dragDropSource([this] {
|
||||
std::ignore = ig::dragDropSource([this] {
|
||||
ImGui::Text("%s", m_name.c_str());
|
||||
return ig::setDragDropPayload("FileRef", FileRef{fullPath<ox::String>()});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -80,11 +82,4 @@ void ProjectTreeModel::drawDirContextMenu() const noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
ox::BasicString<255> ProjectTreeModel::fullPath() const noexcept {
|
||||
if (m_parent) {
|
||||
return m_parent->fullPath() + "/" + m_name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,8 +32,14 @@ class ProjectTreeModel {
|
||||
private:
|
||||
void drawDirContextMenu() const noexcept;
|
||||
|
||||
template<typename Str = ox::BasicString<255>>
|
||||
[[nodiscard]]
|
||||
ox::BasicString<255> fullPath() const noexcept;
|
||||
Str fullPath() const noexcept {
|
||||
if (m_parent) {
|
||||
return m_parent->fullPath<Str>() + "/" + m_name;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user