]> git.saurik.com Git - wxWidgets.git/blob - src/mac/dnd.cpp
toplevel fixes
[wxWidgets.git] / src / mac / 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 #if wxUSE_DRAG_AND_DROP
22
23 // ----------------------------------------------------------------------------
24 // global
25 // ----------------------------------------------------------------------------
26
27 // ----------------------------------------------------------------------------
28 // wxDropTarget
29 // ----------------------------------------------------------------------------
30
31 wxDropTarget::wxDropTarget()
32 {
33 };
34
35 wxDropTarget::~wxDropTarget()
36 {
37 };
38
39 // ----------------------------------------------------------------------------
40 // wxTextDropTarget
41 // ----------------------------------------------------------------------------
42 #ifndef __DARWIN__
43 bool wxTextDropTarget::OnDrop( wxCoord x, wxCoord y, const void *pData )
44 {
45 OnDropText( x, y, (const char*)pData );
46 return TRUE;
47 };
48 #endif
49
50 bool wxTextDropTarget::OnDropText( wxCoord x, wxCoord y, const wxString &psz )
51 {
52 printf( "Got dropped text: %s.\n", (char *)psz );
53 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
54 return TRUE;
55 };
56
57 #ifndef __DARWIN__
58 size_t wxTextDropTarget::GetFormatCount() const
59 {
60 return 1;
61 }
62
63 wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
64 {
65 return wxDF_TEXT;
66 }
67 #endif
68
69 // ----------------------------------------------------------------------------
70 // wxFileDropTarget
71 // ----------------------------------------------------------------------------
72
73 #ifndef __DARWIN__
74 bool wxFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
75 {
76 printf( "Got %d dropped files.\n", (int)nFiles );
77 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
78 return TRUE;
79 }
80 #endif
81
82 bool wxFileDropTarget::OnDrop(wxCoord x, wxCoord y, const wxArrayString& filenames)
83 {
84 return OnDropFiles(x, y, 1, &filenames);
85 }
86
87 #ifndef __DARWIN__
88 size_t wxFileDropTarget::GetFormatCount() const
89 {
90 return 1;
91 }
92
93 wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
94 {
95 return wxDF_FILENAME;
96 }
97 #endif
98
99 //-------------------------------------------------------------------------
100 // wxDropSource
101 //-------------------------------------------------------------------------
102
103 //-----------------------------------------------------------------------------
104 // drag request
105
106 wxDropSource::wxDropSource( wxWindow *win )
107 {
108 // TODO
109 // m_window = win;
110 m_data = NULL;
111
112 // m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
113 // m_goaheadCursor = wxCursor( wxCURSOR_HAND );
114 };
115
116 wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
117 {
118 // TODO
119 // m_window = win;
120 m_data = &data;
121
122 // m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
123 // m_goaheadCursor = wxCursor( wxCURSOR_HAND );
124 };
125
126 void wxDropSource::SetData( wxDataObject &data )
127 {
128 m_data = &data;
129 };
130
131 wxDropSource::~wxDropSource(void)
132 {
133 };
134
135 wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
136 {
137 // TODO
138 return wxDragError;
139 };
140
141 #endif