]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/carbon/dnd.cpp
added wxListView class: this is going to be a wxListCtrl with human (inter)face
[wxWidgets.git] / src / mac / carbon / dnd.cpp
... / ...
CommitLineData
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
31wxDropTarget::wxDropTarget()
32{
33};
34
35wxDropTarget::~wxDropTarget()
36{
37};
38
39// ----------------------------------------------------------------------------
40// wxTextDropTarget
41// ----------------------------------------------------------------------------
42#ifndef __WXMAC_X__
43bool wxTextDropTarget::OnDrop( wxCoord x, wxCoord y, const void *pData )
44{
45 OnDropText( x, y, (const char*)pData );
46 return TRUE;
47};
48#endif
49
50bool 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 __WXMAC_X__
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}
67#endif
68
69// ----------------------------------------------------------------------------
70// wxFileDropTarget
71// ----------------------------------------------------------------------------
72
73#ifndef __WXMAC_X__
74bool 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
82bool wxFileDropTarget::OnDrop(wxCoord x, wxCoord y, const wxArrayString& filenames)
83{
84 return OnDropFiles(x, y, 1, &filenames);
85}
86
87#ifndef __WXMAC_X__
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}
97#endif
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
141#endif