]> git.saurik.com Git - wxWidgets.git/blob - src/qt/dnd.cpp
Merged some STC fixes over to the main branch
[wxWidgets.git] / src / qt / dnd.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: dnd.cpp
3 // Purpose: wxDropTarget, wxDropSource, wxDataObject implementation
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 AUTHOR
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "dnd.h"
14 #endif
15
16 #include "wx/dnd.h"
17 #include "wx/window.h"
18 #include "wx/app.h"
19 #include "wx/gdicmn.h"
20
21 // ----------------------------------------------------------------------------
22 // global
23 // ----------------------------------------------------------------------------
24
25 // ----------------------------------------------------------------------------
26 // wxDropTarget
27 // ----------------------------------------------------------------------------
28
29 wxDropTarget::wxDropTarget()
30 {
31 };
32
33 wxDropTarget::~wxDropTarget()
34 {
35 };
36
37 // ----------------------------------------------------------------------------
38 // wxTextDropTarget
39 // ----------------------------------------------------------------------------
40
41 bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
42 {
43 OnDropText( x, y, (const char*)pData );
44 return TRUE;
45 };
46
47 bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
48 {
49 printf( "Got dropped text: %s.\n", psz );
50 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
51 return TRUE;
52 };
53
54 size_t wxTextDropTarget::GetFormatCount() const
55 {
56 return 1;
57 }
58
59 wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
60 {
61 return wxDF_TEXT;
62 }
63
64 // ----------------------------------------------------------------------------
65 // wxFileDropTarget
66 // ----------------------------------------------------------------------------
67
68 bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
69 {
70 printf( "Got %d dropped files.\n", (int)nFiles );
71 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
72 return TRUE;
73 }
74
75 bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
76 {
77 char *str = "/this/is/a/path.txt";
78
79 return OnDropFiles(x, y, 1, &str );
80 }
81
82 size_t wxFileDropTarget::GetFormatCount() const
83 {
84 return 1;
85 }
86
87 wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
88 {
89 return wxDF_FILENAME;
90 }
91
92 //-------------------------------------------------------------------------
93 // wxDropSource
94 //-------------------------------------------------------------------------
95
96 //-----------------------------------------------------------------------------
97 // drag request
98
99 wxDropSource::wxDropSource( wxWindow *win )
100 {
101 // TODO
102 m_window = win;
103 m_data = NULL;
104
105 m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
106 m_goaheadCursor = wxCursor( wxCURSOR_HAND );
107 };
108
109 wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
110 {
111 // TODO
112 m_window = win;
113 m_data = &data;
114
115 m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
116 m_goaheadCursor = wxCursor( wxCURSOR_HAND );
117 };
118
119 void wxDropSource::SetData( wxDataObject &data )
120 {
121 m_data = &data;
122 };
123
124 wxDropSource::~wxDropSource(void)
125 {
126 };
127
128 wxDropSource::DragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
129 {
130 // TODO
131 return Error;
132 };
133