From e72c327a84d1937c05cc14a5e2ab232584e2cb9d Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Tue, 12 Mar 2024 21:45:35 +0100 Subject: dragdrop file work --- src/main.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 4520d9c..4365f2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -500,7 +500,25 @@ void ts_create_gui(int window_w, int window_h) { } pos_y += textbox_area_height + 7; - if (current_search_result) + if (dragdrop_data.did_drop) { + printf("Do loading..\n"); + dragdrop_data.did_drop = false; + } + + if (dragdrop_data.is_dragging_file) + { + if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceExtern)) // we use an external source (i.e. not ImGui-created) + { + ImGui::SetDragDropPayload("FILES", nullptr, 0); + ImGui::BeginTooltip(); + ImGui::Text("Drop to load file"); + ImGui::EndTooltip(); + ImGui::EndDragDropSource(); + } + + ImGui::Text("Drag test"); + } + else if (current_search_result) { // Results ImGui::SetNextWindowPos({5, pos_y}); -- cgit v1.2.3-70-g09d2