]> git.saurik.com Git - wxWidgets.git/blame - src/mac/dnd.cpp
added wxListView class: this is going to be a wxListCtrl with human (inter)face
[wxWidgets.git] / src / mac / dnd.cpp
CommitLineData
e9576ca5
SC
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
2f1ae414
SC
21#if wxUSE_DRAG_AND_DROP
22
e9576ca5
SC
23// ----------------------------------------------------------------------------
24// global
25// ----------------------------------------------------------------------------
26
27// ----------------------------------------------------------------------------
28// wxDropTarget
29// ----------------------------------------------------------------------------
30
31wxDropTarget::wxDropTarget()
32{
33};
34
35wxDropTarget::~wxDropTarget()
36{
37};
38
39// ----------------------------------------------------------------------------
40// wxTextDropTarget
41// ----------------------------------------------------------------------------
5fde6fcc
GD
42#ifndef __WXMAC_X__
43bool wxTextDropTarget::OnDrop( wxCoord x, wxCoord y, const void *pData )
e9576ca5
SC
44{
45 OnDropText( x, y, (const char*)pData );
46 return TRUE;
47};
5fde6fcc 48#endif
e9576ca5 49
5fde6fcc 50bool wxTextDropTarget::OnDropText( wxCoord x, wxCoord y, const wxString &psz )
e9576ca5 51{
5fde6fcc 52 printf( "Got dropped text: %s.\n", (char *)psz );
e9576ca5
SC
53 printf( "At x: %d, y: %d.\n", (int)x, (int)y );
54 return TRUE;
55};
56
5fde6fcc 57#ifndef __WXMAC_X__
e9576ca5
SC
58size_t wxTextDropTarget::GetFormatCount() const
59{
60 return 1;
61}
62
63wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
64{
65 return wxDF_TEXT;
66}
5fde6fcc 67#endif
e9576ca5
SC
68
69// ----------------------------------------------------------------------------
70// wxFileDropTarget
71// ----------------------------------------------------------------------------
72
5fde6fcc
GD
73#ifndef __WXMAC_X__
74bool wxFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
e9576ca5
SC
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}
5fde6fcc 80#endif
e9576ca5 81
5fde6fcc 82bool wxFileDropTarget::OnDrop(wxCoord x, wxCoord y, const wxArrayString& filenames)
e9576ca5 83{
5fde6fcc 84 return OnDropFiles(x, y, 1, &filenames);
e9576ca5
SC
85}
86
5fde6fcc 87#ifndef __WXMAC_X__
e9576ca5
SC
88size_t wxFileDropTarget::GetFormatCount() const
89{
90 return 1;
91}
92
93wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
94{
95 return wxDF_FILENAME;
96}
5fde6fcc 97#endif
e9576ca5
SC
98
99//-------------------------------------------------------------------------
100// wxDropSource
101//-------------------------------------------------------------------------
102
103//-----------------------------------------------------------------------------
104// drag request
105
106wxDropSource::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
116wxDropSource::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
126void wxDropSource::SetData( wxDataObject &data )
127{
128 m_data = &data;
129};
130
131wxDropSource::~wxDropSource(void)
132{
133};
134
135wxDragResult wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove) )
136{
137 // TODO
138 return wxDragError;
139};
140
03e11df5 141#endif