]>
git.saurik.com Git - wxWidgets.git/blob - src/qt/dnd.cpp
1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDropTarget class
4 // Author: Robert Roebling
5 // Copyright: Robert Roebling
6 // Licence: wxWindows license
7 ///////////////////////////////////////////////////////////////////////////////
10 #pragma implementation "dnd.h"
14 #include "wx/window.h"
16 #include "wx/gdicmn.h"
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
22 extern bool g_blockEventsOnDrag
;
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 wxDropTarget::wxDropTarget()
32 wxDropTarget::~wxDropTarget()
36 // ----------------------------------------------------------------------------
38 // ----------------------------------------------------------------------------
40 bool wxTextDropTarget::OnDrop( long x
, long y
, const void *pData
)
42 OnDropText( x
, y
, (const char*)pData
);
46 bool wxTextDropTarget::OnDropText( long x
, long y
, const char *psz
)
48 printf( "Got dropped text: %s.\n", psz
);
49 printf( "At x: %d, y: %d.\n", (int)x
, (int)y
);
53 size_t wxTextDropTarget::GetFormatCount() const
58 wxDataFormat
wxTextDropTarget::GetFormat(size_t WXUNUSED(n
)) const
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 bool wxFileDropTarget::OnDropFiles( long x
, long y
, size_t nFiles
, const char * const WXUNUSED(aszFiles
)[] )
69 printf( "Got %d dropped files.\n", (int)nFiles
);
70 printf( "At x: %d, y: %d.\n", (int)x
, (int)y
);
74 bool wxFileDropTarget::OnDrop(long x
, long y
, const void *WXUNUSED(pData
) )
76 char *str
= "/this/is/a/path.txt";
78 return OnDropFiles(x
, y
, 1, &str
);
81 size_t wxFileDropTarget::GetFormatCount() const
86 wxDataFormat
wxFileDropTarget::GetFormat(size_t WXUNUSED(n
)) const
91 //-------------------------------------------------------------------------
93 //-------------------------------------------------------------------------
95 wxDropSource::wxDropSource( wxWindow
*WXUNUSED(win
) )
97 g_blockEventsOnDrag
= TRUE
;
100 wxDropSource::wxDropSource( wxDataObject
&data
, wxWindow
*WXUNUSED(win
) )
102 g_blockEventsOnDrag
= TRUE
;
107 void wxDropSource::SetData( wxDataObject
&data
)
112 wxDropSource::~wxDropSource(void)
114 // if (m_data) delete m_data;
116 g_blockEventsOnDrag
= FALSE
;
119 wxDropSource::DragResult
wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove
) )