![]() |
wxIScan
|
The file drop handler (file drop target). More...
#include <wxextfiledroptarget.h>
Public Member Functions | |
wxExtFileDropTarget (wxEvtHandler *poOwner) | |
Standard constructor. | |
virtual bool | OnDropFiles (wxCoord x, wxCoord y, const wxArrayString &astrFilenames) |
Handler for file dropping. | |
Private Attributes | |
wxEvtHandler * | m_poOwner |
Internal pointer to the owner event handler. |
The file drop handler (file drop target).
This is a generic helper class for file dropping. Use SetDropTarget( new wxExtFileDropTarget( this ) ); and install a handler for EVT_EXTFILEDROP( XXX::OnFileDrop ) in a class XXX derived from wxWindow (or at least wxEvtHandler) to use this class.
Definition at line 90 of file wxextfiledroptarget.h.
wxExtFileDropTarget::wxExtFileDropTarget | ( | wxEvtHandler * | poOwner | ) | [inline] |
Standard constructor.
poOwner | a pointer to the owner event handler. |
Definition at line 96 of file wxextfiledroptarget.h.
References m_poOwner.
{ m_poOwner= poOwner; }
bool wxExtFileDropTarget::OnDropFiles | ( | wxCoord | x, |
wxCoord | y, | ||
const wxArrayString & | astrFilenames | ||
) | [virtual] |
Handler for file dropping.
x | Unused. |
y | Unused. |
astrFilenames | string array of the dropped file names.. |
Definition at line 29 of file wxextfiledroptarget.cpp.
References wxExtFileDropEvent::SetFileName().
{ // Check if there is a valid owner window. if( m_poOwner == NULL ) { // Otherwise quit and signal an error. return false; } // File drop event to post to the owner window. wxExtFileDropEvent oEvent; // Get the number of items that are to be dropped... unsigned nCount= astrFilenames.GetCount(); // ... and open them one by one using the owner window's event process chain. for( unsigned i= 0; i < nCount; i++ ) { // Forward a file drop event with the current file name to the owner window. oEvent.SetFileName( astrFilenames[i] ); m_poOwner->ProcessEvent( oEvent ); } // Signal success. return true; }
wxEvtHandler* wxExtFileDropTarget::m_poOwner [private] |
Internal pointer to the owner event handler.
Definition at line 110 of file wxextfiledroptarget.h.
Referenced by wxExtFileDropTarget().