-bool wxTextDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
-{
- if (IsSupported( wxDF_TEXT ))
- {
- RequestData( wxDF_TEXT );
- return TRUE;
- }
-
- return FALSE;
-}
-
-bool wxTextDropTarget::OnData( long x, long y )
-{
- wxTextDataObject data;
- if (!GetData( &data )) return FALSE;
-
- OnDropText( x, y, data.GetText() );
-
- return TRUE;
-}
-
-//-------------------------------------------------------------------------
-// wxPrivateDropTarget
-//-------------------------------------------------------------------------
-
-wxPrivateDropTarget::wxPrivateDropTarget()
-{
- m_id = wxTheApp->GetAppName();
-}
-
-wxPrivateDropTarget::wxPrivateDropTarget( const wxString &id )
-{
- m_id = id;
-}
-
-bool wxPrivateDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( m_id );
-}
-
-bool wxPrivateDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
-{
- if (!IsSupported( m_id ))
- {
- RequestData( m_id );
- return FALSE;
- }
-
- return FALSE;
-}
-
-bool wxPrivateDropTarget::OnData( long x, long y )
-{
- if (!IsSupported( m_id )) return FALSE;
-
- wxPrivateDataObject data;
- if (!GetData( &data )) return FALSE;
-
- OnDropData( x, y, data.GetData(), data.GetSize() );
-
- return TRUE;
-}
-
-//----------------------------------------------------------------------------
-// A drop target which accepts files (dragged from File Manager or Explorer)
-//----------------------------------------------------------------------------
-
-bool wxFileDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( wxDF_FILENAME );
-}
-
-bool wxFileDropTarget::OnDrop( long x, long y )
-{
- if (IsSupported( wxDF_FILENAME ))
- {
- RequestData( wxDF_FILENAME );
- return TRUE;
- }
-
- return FALSE;
-}
-
-bool wxFileDropTarget::OnData( long x, long y )
-{
- wxFileDataObject data;
- if (!GetData( &data )) return FALSE;
-
- /* get number of substrings /root/mytext.txt/0/root/myothertext.txt/0/0 */
- size_t number = 0;
- size_t i;
- size_t size = data.GetFiles().Length();
- wxChar *text = WXSTRINGCAST data.GetFiles();
- for ( i = 0; i < size; i++)
- if (text[i] == 0) number++;
-
- if (number == 0) return FALSE;
-
- wxChar **files = new wxChar*[number];
-
- text = WXSTRINGCAST data.GetFiles();
- for (i = 0; i < number; i++)
- {
- files[i] = text;
- int len = wxStrlen( text );
- text += len+1;
- }
-
- OnDropFiles( x, y, number, files );
-
- free( files );
-
- return TRUE;