Hi
I just finished adding DragDrop to Win32::GUI.

I didn't like the Loft methods and it's Win32::API dependency,
so it's a good GUI.xs and Window.xs integration with the "DropFiles"
NEM and OEM events supported.
Attached is the generated pod and patch.

A Window can use the -dropfiles => 0|1 option to accept dropping files,
or the DragAcceptFiles() method.
The event can be registered via <name>_DropFiles or via -onDropFiles.
Sample:
sub Main_DropFiles {
  # check if called as method or function
  if ($_[0] =~ /Win32::GUI::(Window|DialogBox)/) {
    shift;
  }
  # now the DragDrop handle should be on the stack. (not an object yet though)
  my $files = Win32::GUI::DragDrop::DragQueryFiles(shift);
  return 0 unless @$files;
  ...
}

Some notes:
The DragDrop handle passed to the event is no object yet.
So only the function call is supported yet, not as method.

sub win_DropFiles { $files = $_[0]->DragQueryFiles(); } # invalid!
I didn't care to stash the handle in XS yet. It's just a long.
--
Reini Urban
http://phpwiki.org/
http://spacemovie.mur.at/   http://helsinki.at/

Attachment: DragDrop.pod
Description: Binary data

Attachment: dragdrop.patch
Description: Binary data

Reply via email to