]> git.saurik.com Git - wxWidgets.git/blame - src/qt/dnd.cpp
Since wxREADONLY has disappeared, I had to change to wxTE_READONLY
[wxWidgets.git] / src / qt / dnd.cpp
CommitLineData
7c78e7c7
RR
1///////////////////////////////////////////////////////////////////////////////
2// Name: dnd.cpp
3// Purpose: wxDropTarget class
4// Author: Robert Roebling
5// Copyright: Robert Roebling
6// Licence: wxWindows license
7///////////////////////////////////////////////////////////////////////////////
8
9#ifdef __GNUG__
10#pragma implementation "dnd.h"
11#endif
12
13#include "wx/dnd.h"
14#include "wx/window.h"
15#include "wx/app.h"
16#include "wx/gdicmn.h"
17
18// ----------------------------------------------------------------------------
19// global
20// ----------------------------------------------------------------------------
21
22extern bool g_blockEventsOnDrag;
23
24// ----------------------------------------------------------------------------
25// wxDropTarget
26// ----------------------------------------------------------------------------
27
28wxDropTarget::wxDropTarget()
29{
30};
31
32wxDropTarget::~wxDropTarget()
33{
34};
35
36// ----------------------------------------------------------------------------
37// wxTextDropTarget
38// ----------------------------------------------------------------------------
39
40bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
41{
42 OnDropText( x, y, (const char*)pData );
43 return TRUE;
44};
45
46bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
47{
48 printf( "Got dropped text: %s.\n", psz );
49 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
50 return TRUE;
51};
52
53size_t wxTextDropTarget::GetFormatCount() const
54{
55 return 1;
56}
57
58wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
59{
60 return wxDF_TEXT;
61}
62
63// ----------------------------------------------------------------------------
64// wxFileDropTarget
65// ----------------------------------------------------------------------------
66
67bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
68{
69 printf( "Got %d dropped files.\n", (int)nFiles );
70 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
71 return TRUE;
72}
73
74bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
75{
76 char *str = "/this/is/a/path.txt";
77
78 return OnDropFiles(x, y, 1, &str );
79}
80
81size_t wxFileDropTarget::GetFormatCount() const
82{
83 return 1;
84}
85
86wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
87{
88 return wxDF_FILENAME;
89}
90
91//-------------------------------------------------------------------------
92// wxDropSource
93//-------------------------------------------------------------------------
94
95wxDropSource::wxDropSource( wxWindow *WXUNUSED(win) )
96{
97 g_blockEventsOnDrag = TRUE;
98};
99
100wxDropSource::wxDropSource( wxDataObject &data, wxWindow *WXUNUSED(win) )
101{
102 g_blockEventsOnDrag = TRUE;
103
104 m_data = &data;
105};
106
107void wxDropSource::SetData( wxDataObject &data )
108{
109 m_data = &data;
110};
111
112wxDropSource::~wxDropSource(void)
113{
114// if (m_data) delete m_data;
115
116 g_blockEventsOnDrag = FALSE;
117};
118
119wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
120{
121 return Copy;
122};
123