plusui-native-core 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
#include <mutex>
|
|
4
4
|
#include <filesystem>
|
|
5
5
|
#include <fstream>
|
|
6
|
+
#include <unordered_map>
|
|
7
|
+
#include <cctype>
|
|
6
8
|
|
|
7
9
|
#ifdef _WIN32
|
|
8
10
|
#define WIN32_LEAN_AND_MEAN
|
|
@@ -171,8 +173,10 @@ static std::string getMimeType(const std::string& filePath) {
|
|
|
171
173
|
// Platform-specific helper to handle dropped files
|
|
172
174
|
#ifdef _WIN32
|
|
173
175
|
// Windows implementation for handling WM_DROPFILES message
|
|
174
|
-
void HandleDropFiles(
|
|
175
|
-
|
|
176
|
+
void HandleDropFiles(bool enabled,
|
|
177
|
+
const std::function<void(const std::vector<FileInfo>&)>& filesDroppedCallback,
|
|
178
|
+
HDROP hDrop) {
|
|
179
|
+
if (!enabled || !filesDroppedCallback) {
|
|
176
180
|
return;
|
|
177
181
|
}
|
|
178
182
|
|
|
@@ -215,8 +219,8 @@ void HandleDropFiles(FileDrop::Impl* impl, HDROP hDrop) {
|
|
|
215
219
|
|
|
216
220
|
DragFinish(hDrop);
|
|
217
221
|
|
|
218
|
-
if (!files.empty() &&
|
|
219
|
-
|
|
222
|
+
if (!files.empty() && filesDroppedCallback) {
|
|
223
|
+
filesDroppedCallback(files);
|
|
220
224
|
}
|
|
221
225
|
}
|
|
222
226
|
#endif
|
|
@@ -225,8 +229,10 @@ void HandleDropFiles(FileDrop::Impl* impl, HDROP hDrop) {
|
|
|
225
229
|
// macOS implementation using NSPasteboard and drag&drop APIs
|
|
226
230
|
// This would be implemented with Objective-C++ integration with NSView
|
|
227
231
|
// For now, providing the interface structure
|
|
228
|
-
void HandleMacDropFiles(
|
|
229
|
-
|
|
232
|
+
void HandleMacDropFiles(bool enabled,
|
|
233
|
+
const std::function<void(const std::vector<FileInfo>&)>& filesDroppedCallback,
|
|
234
|
+
NSArray<NSURL*>* urls) {
|
|
235
|
+
if (!enabled || !filesDroppedCallback) {
|
|
230
236
|
return;
|
|
231
237
|
}
|
|
232
238
|
|
|
@@ -256,16 +262,18 @@ void HandleMacDropFiles(FileDrop::Impl* impl, NSArray<NSURL*>* urls) {
|
|
|
256
262
|
files.push_back(info);
|
|
257
263
|
}
|
|
258
264
|
|
|
259
|
-
if (!files.empty() &&
|
|
260
|
-
|
|
265
|
+
if (!files.empty() && filesDroppedCallback) {
|
|
266
|
+
filesDroppedCallback(files);
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
269
|
#endif
|
|
264
270
|
|
|
265
271
|
#ifdef __linux__
|
|
266
272
|
// Linux/GTK implementation
|
|
267
|
-
void HandleGtkDropFiles(
|
|
268
|
-
|
|
273
|
+
void HandleGtkDropFiles(bool enabled,
|
|
274
|
+
const std::function<void(const std::vector<FileInfo>&)>& filesDroppedCallback,
|
|
275
|
+
GtkSelectionData* data) {
|
|
276
|
+
if (!enabled || !filesDroppedCallback) {
|
|
269
277
|
return;
|
|
270
278
|
}
|
|
271
279
|
|
|
@@ -307,8 +315,8 @@ void HandleGtkDropFiles(FileDrop::Impl* impl, GtkSelectionData* data) {
|
|
|
307
315
|
g_strfreev(uris);
|
|
308
316
|
}
|
|
309
317
|
|
|
310
|
-
if (!files.empty() &&
|
|
311
|
-
|
|
318
|
+
if (!files.empty() && filesDroppedCallback) {
|
|
319
|
+
filesDroppedCallback(files);
|
|
312
320
|
}
|
|
313
321
|
}
|
|
314
322
|
#endif
|