wxIScan
wxExtFileDropTarget Class Reference

The file drop handler (file drop target). More...

#include <wxextfiledroptarget.h>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

wxExtFileDropTarget::wxExtFileDropTarget ( wxEvtHandler *  poOwner) [inline]

Standard constructor.

Parameters:
poOwnera pointer to the owner event handler.

Definition at line 96 of file wxextfiledroptarget.h.

References m_poOwner.

    {
        m_poOwner= poOwner;
    }

Member Function Documentation

bool wxExtFileDropTarget::OnDropFiles ( wxCoord  x,
wxCoord  y,
const wxArrayString &  astrFilenames 
) [virtual]

Handler for file dropping.

Parameters:
xUnused.
yUnused.
astrFilenamesstring 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;
}

Member Data Documentation

wxEvtHandler* wxExtFileDropTarget::m_poOwner [private]

Internal pointer to the owner event handler.

Definition at line 110 of file wxextfiledroptarget.h.

Referenced by wxExtFileDropTarget().


The documentation for this class was generated from the following files: