![]() |
|
File drag & drop concept |
DanielH
Member #934
January 2001
![]() |
Ok, I've been working on adding drag and drop to a display. After 3 days, I finally got allegro compiled to test. Currently, I am please at the progress, but I would like to change things a bit. Right now the drop copies files to a static string array and any new drops will overwrite the last. I would like to instead append to end some sort of dynamic list. This is what I have now for an event. Technically it is a display event as you drop the files onto the display. typedef struct ALLEGRO_DROPFILE_EVENT { _AL_EVENT_HEADER(struct ALLEGRO_DISPLAY) int32_t x; int32_t y; int32_t count; const char **filenames; } ALLEGRO_DROPFILE_EVENT;
1#ifndef __al_included_allegro5_dropfile_h
2#define __al_included_allegro5_dropfile_h
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8AL_FUNC(bool, al_install_drag_drop, (ALLEGRO_DISPLAY *display));
9AL_FUNC(void, al_uninstall_drag_drop, (void));
10
11#ifdef __cplusplus
12 }
13#endif
14
15#endif
bool processEvent(ALLEGRO_EVENT &event) { switch (event.type) { case ALLEGRO_EVENT_DROP_FILES: { int32_t count = event.drop.count; const char **files = event.drop.filenames; } break; ... Thoughts? Suggestions? |
Trent Gamblin
Member #261
April 2000
![]() |
Needs to be more generic. Drag and drop just about anything. And needs Mac and Linux support before considered seriously.
|
Mark Oates
Member #1,146
March 2001
![]() |
Yea, what Trent said. That was my first thought, too. The API should allow for any content type (or just supported content types) to be dropped, not just files. Is allegro dev on GitHub? Where's the main development activity? -- |
Thomas Fjellstrom
Member #476
June 2000
![]() |
Mark Oates said: Is allegro dev on GitHub? Where's the main development activity? there's a github mirror, but main repo is on sourceforge. -- |
Gideon Weems
Member #3,925
October 2003
|
DanielH
Member #934
January 2001
![]() |
I did a simple search and how to add drag drop to a program was using WM_DROPFILES message. So, that's what I focused on. Adding support for data is similar to clipboard access. Will have to look into that. |
|